Skip to content

Instantly share code, notes, and snippets.

View tanghaiduong's full-sized avatar
:octocat:

Duong Tang tanghaiduong

:octocat:
View GitHub Profile
@tanghaiduong
tanghaiduong / bitsadmin.md
Created May 16, 2018 07:23 — forked from xnohat/bitsadmin.md
Use bitsadmin to download via the command line on Windows 7 (8?)

Download via the command line on Windows 7

If you want to test your connection or have some other reason to use the command line to download a file, this is how.

See http://superuser.com/a/284147 for more information.

Open cmd.exe and use this format:

bitsadmin /transfer debjob /download /priority normal http://cdimage.debian.org/debian-cd/current-live/i386/iso-hybrid/debian-live-8.7.1-i386-xfce-desktop.iso D:\Users\[Username]\Downloads\debian-live-8.7.1-i386-xfce-desktop.iso
@tanghaiduong
tanghaiduong / exit_status.csv
Created March 27, 2018 05:05
Make Exit Status Values
Exit status Meaning
0 Normal exit with no errors.
1 General purpose error if no other explicit error is known.
2 There was an error in the makefile.
3 A shell line had a non-zero status.
4 Make ran out of memory.
5 The program specified on the shell line was not executable.
6 The shell line was longer than the command processor allowed.
7 The program specified on the shell line could not be found.
8 There was not enough memory to execute the shell line.
@tanghaiduong
tanghaiduong / homebrew.md
Created October 9, 2017 02:19 — forked from indiesquidge/homebrew.md
How to and Best of Homebrew

Homebrew

How To

Homebrew is a package management system for OS X. You can read more about it here, or simply run

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

to install it.

@tanghaiduong
tanghaiduong / brew list.txt
Created August 28, 2017 07:21
packages I use from homebrew
ack
adns
ant
antibody
aria2
asciinema
aspcud
autoconf
autojump
automake
@tanghaiduong
tanghaiduong / reflection.go
Created August 21, 2017 07:34 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --delete-config retention.ms

#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@tanghaiduong
tanghaiduong / 1. Install Redis
Created June 10, 2017 15:39 — forked from pbolduc/1. Install Redis
Install redis on CentOS 7
# see How to Install Redis Server on CentOS 7 - http://linoxide.com/storage/install-redis-server-centos-7/
# --- Compiling ---
$ yum install gcc make tcl
$ REDIS_VER=3.2.3
$ wget http://download.redis.io/releases/redis-$REDIS_VER.tar.gz
$ tar xzvf redis-$REDIS_VER.tar.gz
$ cd redis-$REDIS_VER
$ make
$ make test
@tanghaiduong
tanghaiduong / nginxproxy.md
Created March 20, 2017 02:04 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers