Skip to content

Instantly share code, notes, and snippets.

@bynil
bynil / NoBug
Created June 6, 2015 13:50
Code is far away from bug
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@bynil
bynil / gist:f431cbc95ce66f8f5fef
Created October 1, 2015 10:38
UITableViewCell separator inset fix
//UITableView
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsMake(0, 16, 0, 0)];
}
if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) {
[tableView setLayoutMargins:UIEdgeInsetsZero];
@bynil
bynil / surge.conf
Created October 26, 2015 16:04 — forked from soffchen/surge.conf
surge.conf
[General]
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 0.0.0.0/8, 1.0.0.0/9, 1.160.0.0/11, 1.192.0.0/11, 10.0.0.0/8, 14.0.0.0/11, 14.96.0.0/11, 14.128.0.0/11, 14.192.0.0/11, 27.0.0.0/10, 27.96.0.0/11, 27.128.0.0/9, 36.0.0.0/10, 36.96.0.0/11, 36.128.0.0/9, 39.0.0.0/11, 39.64.0.0/10, 39.128.0.0/10, 42.0.0.0/8, 43.224.0.0/11, 45.64.0.0/10, 47.64.0.0/10, 49.0.0.0/9, 49.128.0.0/11, 49.192.0.0/10, 54.192.0.0/11, 58.0.0.0/9, 58.128.0.0/11, 58.192.0.0/10, 59.32.0.0/11, 59.64.0.0/10, 59.128.0.0/9, 60.0.0.0/10, 60.160.0.0/11, 60.192.0.0/10, 61.0.0.0/10, 61.64.0.0/11, 61.128.0.0/10, 61.224.0.0/11, 100.64.0.0/10, 101.0.0.0/9, 101.128.0.0/11, 101.192.0.0/10, 103.0.0.0/10, 103.192.0.0/10, 106.0.0.0/9, 106.224.0.0/11, 110.0.0.0/7, 112.0.0.0/9, 112.128.0.0/11, 112.192.0.0/10, 113.0.0.0/9, 113.128.0.0/11, 113.192.0.0/10, 114.0.0.0/9, 114.128.0.0/11, 114.192.0.0/10, 115.0.0.0/8, 116.0.0.0/8, 117.0.0.0/9, 117.128.0.0/10, 118.0.0.0/11, 118.64.0.0/10, 118.128.0.0/9, 119.0.
@bynil
bynil / gist:bc6b6469e8118935aa07
Created November 26, 2015 05:42 — forked from sprhawk/gist:2779208
git diff localizable.strings
(from :http://www.entropy.ch/blog/Developer/2010/04/15/Git-diff-for-Localizable-strings-Files.html)
First, add this to the project’s .git/info/attributes file:
+
*.strings diff=localizablestrings
(Unfortunately you do have to add it to every project, there doesn’t seem to be a global attributes configuration file)
Second, add this to your ~/.gitconfig file:
@bynil
bynil / setup_proxychains-ng.sh
Created January 8, 2017 14:10 — forked from marcinwol/setup_proxychains-ng.sh
Setup and test proxychains-ng on Ubuntu 14.04
# if you havent done it yet, please download the tor-browser and start it
# https://www.torproject.org/download/download-easy.html.en
wget https://www.torproject.org/dist/torbrowser/5.0/tor-browser-linux64-5.0_en-US.tar.xz
tar xf tor-browser-linux64-5.0_en-US.tar.xz
# download the source of proxychains-ng
git clone https://github.com/rofl0r/proxychains-ng.git
cd proxychains-ng
@bynil
bynil / xcode-build-bump.sh
Created March 23, 2017 07:41
Xcode auto-increment build number
#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
@bynil
bynil / config-git-proxy.txt
Last active January 23, 2024 12:37
Use git over socks5 proxy
Port: 1080
1. Create a file /YOUR PATH/gitproxy.sh with content:
#!/bin/sh
nc -X 5 -x 127.0.0.1:1080 "$@"
2. Edit your ~/.gitconfig
# For git://
0483cc0c19c0b2dfe2063ff80da2161eb4d6e74e46dbd18619aebe86e0b165667b217ed7a6f725a526f55ea3e55282b10465086164e6156006339f256e2e30e4cf;sun1534

Keybase proof

I hereby claim:

  • I am bynil on github.
  • I am gexiao (https://keybase.io/gexiao) on keybase.
  • I have a public key ASBKLaQDMvpXadYdTeH7THrd_29yg7Mlei4gi5YBn8zyGQo

To claim this, I am signing this object:

docker images | tail --lines=+2 | while read LINE ; do
REPO=`echo ${LINE} | awk '{print $1}'`
TAG=`echo ${LINE} | awk '{print $2}'`
ID=`echo ${LINE} | awk '{print $3}'`
# Replace '/' characters in REPO with '_'
FILENAME=${REPO//\//_}__${TAG}__${ID}.tar
IMAGE=${REPO}:${TAG}