Skip to content

Instantly share code, notes, and snippets.

View jostyee's full-sized avatar
💭
脑壳疼

Josta Yee jostyee

💭
脑壳疼
  • Singapore
View GitHub Profile
My name is {{.Name}} and I'm {{.Age}} years old!!
@jostyee
jostyee / autopac.sh
Last active September 11, 2015 06:59 — forked from lwr/autopac.sh
使用 https://github.com/clowwindy/gfwlist2pac 生成自定义 PAC 的辅助脚本
#!/bin/bash
GFWLIST=https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt
PROXY=127.0.0.1:7070
cd `dirname "${BASH_SOURCE[0]}"`
echo "Downloading gfwlist from $GFWLIST"
curl "$GFWLIST" --socks5-hostname "$PROXY" > /tmp/gfwlist.txt
/usr/local/bin/gfwlist2pac \
--input /tmp/gfwlist.txt \
@jostyee
jostyee / gistcheck.py
Created March 9, 2016 03:54 — forked from jsbain/gistcheck.py
updated comment: prevent opening of pyui in editor
# Source: https://gist.github.com/5212628
#
# All-purpose gist tool for Pythonista.
#
# When run directly, this script sets up four other scripts that call various
# functions within this file. Each of these sub-scripts are meant for use as
# action menu items. They are:
#
# Set Gist ID.py - Set the gist id that the current file should be
# associated with.
@jostyee
jostyee / multi_zip.sh
Created April 29, 2016 10:01
compress all folders in current directory into their own zip files & then delete originals
#!/bin/sh
for d in $(find . -maxdepth 1 -type d)
do
if [ $d != '.' ]; then
echo -ne "$d "
zip -r -m "$d.zip" "$d"
fi
done
function cdf() # cd to Finder's front window's path
{
path="`osascript -e 'tell application "Finder" to set myname to POSIX path of (target of window 1 as alias)' 2>/dev/null`"
if [ -n "$path" ]; then
echo "cd to $path"
cd "$path"
else
echo "no Finder window found"
fi
}
@jostyee
jostyee / daysdiff.go
Created May 12, 2016 03:03
Calculate Days Between Dates
// original post: https://groups.google.com/d/msg/golang-nuts/O2NaRAH94GI/eXrvZtsTCQAJ
package days
import (
"fmt"
"time"
)
func lastDayOfYear(t time.Time) time.Time {
return time.Date(t.Year(), 12, 31, 0, 0, 0, 0, t.Location())
@jostyee
jostyee / timecost.go
Created June 8, 2016 06:00
Computer the time duration a func consumed
func TimeCost(f func()) time.Duration {
start := time.Now()
f()
return time.Since(start)
}
#!/bin/sh
if [ -z $1 ]
then
echo "Usage: ./dl-slideshare.sh URL"
echo "Example: ./dl-slideshare.sh http://www.slideshare.net/bbaskin/malware-intelligence"
exit 1
fi
savepath="/tmp/slideshare"

Keybase proof

I hereby claim:

  • I am jostyee on github.
  • I am yee (https://keybase.io/yee) on keybase.
  • I have a public key whose fingerprint is 159A 8301 DD6F 2626 F1BF 2458 31D7 8432 F47D 4399

To claim this, I am signing this object: