Skip to content

Instantly share code, notes, and snippets.

Avatar
🏎️

Zheng Hao Tan tzhenghao

🏎️
View GitHub Profile
@tzhenghao
tzhenghao / .gitignore
Created Nov 22, 2015
.gitignore for Code Composer Studio projects
View .gitignore
Release/*
.xdchelp
config/*
.launches/*
@tzhenghao
tzhenghao / torrc
Created Jul 9, 2017
Hidden ssh service torrc
View 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 Jul 9, 2017
Tor Hidden Service Directory Permissions
View hidden-service-example
drwx--S--- 2 debian-tor debian-tor 4096 Jul 9 06:25 hidden-service-example
@tzhenghao
tzhenghao / hostname
Created Jul 9, 2017
hidden-service-example sample hostname file contents
View hostname
abcdefghijklmnop.onion abcdefghijklmnopabcdef # client: hidden-service-example
@tzhenghao
tzhenghao / torrc
Created Jul 9, 2017
Torrc - ServerAuth demo
View torrc
HidServAuth abcdefghijklmnop.onion abcdefghijklmnopabcdef
@tzhenghao
tzhenghao / example-server.py
Created Jan 17, 2018
Simple Python server script
View example-server.py
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 Jan 20, 2018
Create an account via Geth
View create-account-geth.sh
# 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 Jan 21, 2018
How to list all account(s) via Geth
View list-accounts-geth.sh
# 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 Jan 21, 2018
How to update accounts on Geth
View update-accounts-geth.sh
geth account update <ACCOUNT_NUMBER>
#Example:
# geth account update 0
@tzhenghao
tzhenghao / get_ip_address_v1.py
Created Feb 7, 2018
A naive implementation to query an IP address of a machine
View get_ip_address_v1.py
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