Skip to content

Instantly share code, notes, and snippets.

💬
Someone is typing…

Khanh Tran khanhtc1202

💬
Someone is typing…
Block or report user

Report or block khanhtc1202

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@khanhtc1202
khanhtc1202 / README.md
Created Jan 20, 2019 — forked from Lazza/README.md
VPNGate Python script
View README.md

vpngate.py

This script allows to use the free VPN service provided by VPNGate in an easy way. The user just needs to provide the desidered output country, and the script automatically chooses the best server.

After this step, OpenVPN is launched with the proper configuration. The VPN can be terminated by pressing Ctrl+C.

Usage

Run the script by providing the desired output country:

@khanhtc1202
khanhtc1202 / benchmark.go
Created Oct 23, 2018
String concatenate
View benchmark.go
package main
import (
"bytes"
"strings"
"testing"
)
func BenchmarkConcat(b *testing.B) {
var str string
@khanhtc1202
khanhtc1202 / tmux.cheat
Created Jul 20, 2018 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
View tmux.cheat
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@khanhtc1202
khanhtc1202 / weather.sh
Created Jul 14, 2018
Check weather on terminal
View weather.sh
#!/bin/bash
#
# khanhtc 08-11-2017
test -z "$1" && exit
BASEURL="http://wttr.in/"
method="curl -4"
# Run command get weather
@khanhtc1202
khanhtc1202 / promises.md
Created Jun 19, 2018 — forked from domenic/promises.md
You're Missing the Point of Promises
View promises.md

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
    // the rest of your code goes here.
View install-node-js
#!/bin/sh
#
# author: khanhtc
#
# script for installing nodejs from source
#
VERSION=$1
OS=$(uname -s | awk '{print tolower($0)}')
ARCH=$(uname -m | sed 's/x86_/x/g')
@khanhtc1202
khanhtc1202 / di-container.go
Last active May 17, 2018
Sample Dependence Injection Container in GoLang
View di-container.go
package main
import (
"fmt"
)
type UserRepository struct {
Description string
}
@khanhtc1202
khanhtc1202 / uzabase-niconico-attacker.py
Created May 17, 2018
Attacker to niconico comment & like system of Uzabase .inc
View uzabase-niconico-attacker.py
"""
just for fun beacause funthings are fun!!!
require: requests (install by using pip), python (2 or 3)
usage:
python sample.py {pool_size} {action_quantity}
=> for running in real life: pls uncomment this following line
108: requests.get(endpoint, headers=headers)
You can’t perform that action at this time.