This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is Git's per-user configuration file. | |
[user] | |
name = tzhenghao | |
email = [email protected] | |
[alias] | |
all = add . | |
cl = clone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My own aliases. | |
alias q='exit' | |
alias c='clear' | |
alias h='history' | |
alias cs='clear;ls' | |
alias p='cat' | |
alias pd='pwd' | |
alias lsa='ls -a' | |
alias lsl='ls -l' | |
alias pd='pwd' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Help with extractions | |
extract () { | |
if [ -f "$1" ] ; then | |
case "$1" in | |
*.tar.bz2) tar xvjf "$1" ;; | |
*.tar.gz) tar xvzf "$1" ;; | |
*.bz2) bunzip2 "$1" ;; | |
*.rar) unrar x "$1" ;; | |
*.gz) gunzip "$1" ;; | |
*.tar) tar xvf "$1" ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
def get_ip_addresses_v2(): | |
return socket.gethostbyname(socket.gethostname()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import Popen,PIPE | |
def get_ip_addresses(): | |
c1 = Popen(["ip","addr"], stdout=PIPE) | |
addr_table = c1.communicate()[0] | |
addr_table = addr_table.split("\n") | |
index = 0 | |
while index < len(addr_table): | |
if "eth0" in addr_table[index]: | |
break |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
geth account update <ACCOUNT_NUMBER> | |
#Example: | |
# geth account update 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List all account(s) | |
geth account list | |
# List all account(s) that are under the Ropsten test network | |
geth --testnet account list | |
# List all account(s) that are under the Rinkeby test network | |
geth --rinkeby account list | |
# sample output 1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a new account on main Ethereum network. | |
geth account new | |
# Create a new account on the Ropsten network: pre-configured proof-of-work test network | |
geth --testnet account new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import sys | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
print 'Socket created' | |
# Bind socket to local host and port | |
try: | |
s.bind(('0.0.0.0', 4010)) | |
except socket.error as msg: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HidServAuth abcdefghijklmnop.onion abcdefghijklmnopabcdef |