Skip to content

Instantly share code, notes, and snippets.

View tzhenghao's full-sized avatar
🏎️

Zheng Hao Tan tzhenghao

🏎️
View GitHub Profile
@tzhenghao
tzhenghao / get_ip_address_v2_simplified.py
Created February 7, 2018 19:25
A simplified version of getting an IP address of a machine
import socket
def get_ip_addresses_v2():
return socket.gethostbyname(socket.gethostname())
@tzhenghao
tzhenghao / extract-stuff.sh
Created February 22, 2018 05:08
Extract tarballs etc.
# 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" ;;
@tzhenghao
tzhenghao / aliases.sh
Created February 23, 2018 01:08
A bunch of custom bash/zsh aliases I've used over the past few years
# 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'
@tzhenghao
tzhenghao / .gitconfig
Created February 23, 2018 01:09
My Git configs
# This is Git's per-user configuration file.
[user]
name = tzhenghao
email = tanzhao@umich.edu
[alias]
all = add .
cl = clone
@tzhenghao
tzhenghao / install-cli.sh
Created February 23, 2018 01:55
This bash script cleans up the build and reinstalls the SDK
#!/bin/bash
# This bash script cleans up the build and reinstalls the SDK.
# To run this script, do: . test-cli.sh
VERSION_NUMBER=$(cat hologram-python/version.txt)
cd hologram-python
rm -rf dist
rm -rf hologram_python.egg-info
python setup.py sdist
@tzhenghao
tzhenghao / disable-macos-mouse-acceleration.sh
Created March 18, 2018 17:53
Disable MacOS mouse acceleration
#!/bin/bash
set -euo pipefail
# Author: Zheng Hao Tan
# Email: hi@zhenghaotan.com
# This shell scripts disables mouse acceleration on a MacOS device.
echo 'The current mouse scaling value is:'
defaults read .GlobalPreferences com.apple.mouse.scaling
@tzhenghao
tzhenghao / my.html
Created January 14, 2019 03:14
SQ Scammer html script
<!DOCTYPE html>
<head>
<meta property="og:image" content="https://www.airlineratings.com/wp-content/uploads/uploads/singapore_airlines_logo-200x.jpg" />
<meta property="og:title" content="Singapore Airlines is giving away Free tickets to celebrate its 70th Anniversary" />
<script type="text/javascript" language="javascript">
var areYouReallySure = false;
var internalLink = false;
if (typeof window.orientation == 'undefined' && screen.width >= 1000){window.location.href = 'http://google.com'; areYouReallySure=true;}
if (typeof window.orientation == 'undefined' && screen.width >= 1000){window.location.href = 'http://google.com'; areYouReallySure=true;}
@tzhenghao
tzhenghao / singapore-airlines-scam-comment-area.html
Last active March 17, 2019 18:47
Comments section of the Singapore Airlines free ticket scam source code
<div class="comment">
<img class="profile" src="images/1.png" width="50" height="50" />
<p class="com-txt"><a class="name" href="javascript:void(0);">Rachel Singleton</a>
Thank you soo much Singapore Airlines for tickets! i got mine</p>
<div class="act">
<a class="fblike" href="javascript:void(0);">Like</a> ·
<a href="javascript:void(0);">Reply</a> ·
<span class="liked">50</span>
<span class="time">28 mins</span>
</div>
@tzhenghao
tzhenghao / singapore-airlines-scam-whatsapp-share.html
Created March 17, 2019 18:48
Section of the Singapore Airlines WhatsApp shareable link
<div id="content_03" style="display: none; margin-top:15px;">
<div style="font-size:1.4em;margin-bottom:10px;"><strong>Congratulations!</strong></div>
<div style="margin-bottom: 10px">
You have been qualified to get <strong>2 free tickets</strong>! How to proceed :
</div>
1. Share it to 20 of your friends/groups via WHATSAPP (click on the "WhatsApp" icon below).<br />
2. Click on "Claim Tickets" and enter your details.<br />
3. Download the Tickets.
<!-- Button zum Teilen -->