Skip to content

Instantly share code, notes, and snippets.

View tzhenghao's full-sized avatar
🏎️

Zheng Hao Tan tzhenghao

🏎️
View GitHub Profile
@tzhenghao
tzhenghao / .gitignore
Created November 22, 2015 21:20
.gitignore for Code Composer Studio projects
Release/*
.xdchelp
config/*
.launches/*
@tzhenghao
tzhenghao / torrc
Created July 9, 2017 09:44
Hidden ssh service torrc
HiddenServiceDir /var/lib/tor/hidden-service-example/
HiddenServicePort 22 127.0.0.1:22
HiddenServiceAuthorizeClient stealth hidden-service-example
@tzhenghao
tzhenghao / hidden-service-example
Created July 9, 2017 09:53
Tor Hidden Service Directory Permissions
drwx--S--- 2 debian-tor debian-tor 4096 Jul 9 06:25 hidden-service-example
@tzhenghao
tzhenghao / hostname
Created July 9, 2017 09:58
hidden-service-example sample hostname file contents
abcdefghijklmnop.onion abcdefghijklmnopabcdef # client: hidden-service-example
@tzhenghao
tzhenghao / torrc
Created July 9, 2017 10:05
Torrc - ServerAuth demo
HidServAuth abcdefghijklmnop.onion abcdefghijklmnopabcdef
@tzhenghao
tzhenghao / example-server.py
Created January 17, 2018 05:55
Simple Python server script
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:
@tzhenghao
tzhenghao / create-account-geth.sh
Last active January 20, 2018 04:29
Create an account via Geth
# 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
@tzhenghao
tzhenghao / list-accounts-geth.sh
Last active January 21, 2018 19:43
How to list all account(s) via Geth
# 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:
@tzhenghao
tzhenghao / update-accounts-geth.sh
Last active January 21, 2018 20:00
How to update accounts on Geth
geth account update <ACCOUNT_NUMBER>
#Example:
# geth account update 0
@tzhenghao
tzhenghao / get_ip_address_v1.py
Created February 7, 2018 19:23
A naive implementation to query an IP address of a machine
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