Skip to content

Instantly share code, notes, and snippets.

View phanletrunghieu's full-sized avatar
🏎️
Running

Royce phanletrunghieu

🏎️
Running
View GitHub Profile
@phanletrunghieu
phanletrunghieu / README.txt
Created April 12, 2021 13:12
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@phanletrunghieu
phanletrunghieu / README.txt
Created April 12, 2021 13:11
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.6+commit.7338295f.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
#! /bin/bash
export INSTALL_K3S_VERSION=v1.19.8+k3s1
export K3S_URL=https://xx.xx.xx.xx:xxx
export K3S_TOKEN=xxxxxxxxxxxx
curl -sfL https://get.k3s.io | sh -
@phanletrunghieu
phanletrunghieu / pub
Last active March 11, 2021 15:59
pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/wLhgLv0KlOIAJ8SJae3LAXFlpuAy0aCaoh4ULn4/rwJD8RrleHViw49iwDK8QXyB/i6TyCVMtuH1S2/b+cNXncrLbkb+EhkW7wuROo5MviOHn01zEhaK8MAnMFzu6bsTCYppUyHAkBLPskmvH2twE987CQf1glE8QWFfEucWQImcmvOoHMWmbHWAsy9eufWoqIfGQnEcCI5MkoUh9oQ6WdxAOKGww0+uhijcb8j8G06BG0bIGlvPLuHuJ4TOOBDvsRwcC+NOXLnjGj+J47yXneIHLg5N08v4a4GrE+cblw4RYY4FQ9+NkPwRsIfVSMsE0IPThlvbkrd2EpG36FJN hieudeptrai@HieuUbuntu
set-option -ga terminal-override ',rxvt-uni*:XT:Ms=\E]52;%p1%s;%p2%s\007'
set -g mouse on
setw -g mode-keys vi
source-file "${HOME}/.tmux-themepack/powerline/block/cyan.tmuxtheme"
# For binding 'y' to copy and exiting selection mode
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -sel clip -i'
# For binding 'Enter' to copy and not leave selection mode
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe 'xclip -sel clip -i' '\;' send -X clear-selection
@phanletrunghieu
phanletrunghieu / generate.sh
Last active August 15, 2020 15:18
ssl key pair
#!/bin/sh
CA_PASS="1234"
SERVER_PASS="4321"
CLIENT_PASS="5678"
cat > "openssl.cnf" << EOF
[v3_req]
subjectAltName = @alt_names
# Alternative names are specified as IP.# and DNS.# for IP addresses and
@phanletrunghieu
phanletrunghieu / docker-cleanup-resources.md
Created October 1, 2019 09:57 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

### Keybase proof
I hereby claim:
* I am phanletrunghieu on github.
* I am hieudeptrai (https://keybase.io/hieudeptrai) on keybase.
* I have a public key ASCl_5aZUQ6cSiyGQLLWd2_g2F-NfPf5dKITHz7trJQWAAo
To claim this, I am signing this object:
# eth0 is public network interface
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
# Allow connection RELATED,ESTABLISHED on eth0
iptables -t filter -A INPUT -i eth0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# Prevent DOCKER chain
iptables -t nat -I PREROUTING -m addrtype --dst-type LOCAL -j RETURN
@phanletrunghieu
phanletrunghieu / iptables-reload.sh
Created April 22, 2019 09:19 — forked from tehmoon/iptables-reload.sh
IPtables and docker reload!
#!/bin/sh
set -e
## SEE https://medium.com/@ebuschini/iptables-and-docker-95e2496f0b45
CWD=$(cd "$(dirname "${0}")"; pwd -P)
FILE="${CWD}/$(basename "${0}")"
chown root:root "${FILE}"
chmod o-rwx "${FILE}"