Skip to content

Instantly share code, notes, and snippets.

View xream's full-sized avatar

xream xream

View GitHub Profile
@xream
xream / dnsmasq.conf
Created December 30, 2011 00:47
dnsmasq conf of apple services
#apple
#nslookup -vc a1.phobos.apple.com 168.95.1.1
#203.78.36.42 203.69.138.18
#jp 120.29.145.9 124.40.51.32 61.213.183.25
address=/a1.mzstatic.com/203.69.138.18
address=/a2.mzstatic.com/203.69.138.18
address=/a3.mzstatic.com/203.69.138.18
address=/a4.mzstatic.com/203.69.138.18
address=/a5.mzstatic.com/203.69.138.18
address=/a6.mzstatic.com/203.69.138.18
@xream
xream / ssh.c
Created December 30, 2011 05:12
Multiple SSH Tunnels
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <signal.h>
@xream
xream / vpndown.sh
Created January 4, 2012 07:12
restore routes
#!/bin/bash
oldgw=10.211.55.1
vpngw=10.100.0.1
poff
route del default gw $oldgw
route del default gw $vpngw
route add default gw $oldgw
@xream
xream / MacVPN.sh
Created January 9, 2012 12:27
Mac VPN auto reconnect script
#!/bin/bash
#set the VPN service name
VPN=""
function xxre () {
echo "VPN is not connected!"
echo "Reconnecting!"
networksetup -connectpppoeservice $VPN
sleep 5
}
ifconfig|grep ppp0||xxre
@xream
xream / gist:1808672
Created February 12, 2012 13:54
zeller week
#!/bin/bash
year=2010
mon=01
day=01
case $mon in
01) monname="Jan" ;;
02) monname="Feb" ;;
03) monname="Mar" ;;
04) monname="Apr" ;;
@xream
xream / tc.rb
Created March 26, 2012 10:26 — forked from lexrus/tc
Epoch / Unix Timestamp Converter
#!/bin/bash
# sudo chmod +x tc;sudo mv tc /usr/bin
if [[ -z "$1" ]]
then
printf %s "\
Nifty Timestamp Convertor by Lex Tang
tc 2012/12/12
tc 1355283413
"
exit
@xream
xream / ssh.tcl
Created April 10, 2012 08:35
ssh.tcl
#!/usr/bin/expect
set timeout 60
while {1} {
spawn /usr/bin/ssh -NCD :7070 111111@111.com
expect {
"password:" { send "111111\r" }
}
interact {
timeout 60 { send " " }
eof { exp_continue }
@xream
xream / evernoteAdBlock.sh
Created April 11, 2012 09:31
evernoteAdBlock
#!/bin/bash
# sh evernoteAdBlock.sh
cd ~/Library/Application\ Support/Evernote/promos/
rm `ls|grep -v stats.plist`
chmod 555 ../promos
@xream
xream / adbInstallApk.sh
Created April 22, 2012 14:19
adbInstallApk
#!/bin/bash
PATH=$PATH:/usr/local/sbin:/Volumes/data/stuff/code/android-sdk-macosx/platform-tools
for file in `ls|grep .apk`
do
echo $file
adb install $file
done
@xream
xream / flora_pac.py
Created April 24, 2012 03:58
flora_pac.py
#!/usr/bin/env python
#
# Refined by @phuslu
# Flora_Pac by @leaskh
# www.leaskh.com, i@leaskh.com
#
# based on chnroutes project (by Numb.Majority@gmail.com)
#
import re