Skip to content

Instantly share code, notes, and snippets.

@zinbers
zinbers / simple-obfs_centos.sh
Created November 10, 2017 12:03
Install simple-obfs plugin for shadowsocks-libev for CentOS 6 or 7
#! /bin/sh
# Install simple-obfs plugin for shadowsocks-libev for CentOS 6 or 7
# Please install https://github.com/teddysun/shadowsocks_install/raw/master/shadowsocks-libev.sh first
red='\033[0;31m'
green='\033[0;32m'
plain='\033[0m'
[[ $EUID -ne 0 ]] && echo -e "${red}Error:${plain} This script must be run as root!" && exit 1
@zinbers
zinbers / dynamic_quality.py
Created September 7, 2017 10:58 — forked from thebostik/dynamic_quality.py
Python Dynamic Image Quality Example
import cStringIO
import PIL.Image
from ssim import compute_ssim
def get_ssim_at_quality(photo, quality):
"""Return the ssim for this JPEG image saved at the specified quality"""
ssim_photo = cStringIO.StringIO()
# optimize is omitted here as it doesn't affect
# quality but requires additional memory and cpu
@zinbers
zinbers / fixup.txt
Created August 3, 2017 09:24 — forked from lucasdavila/fixup.txt
Fixing mac os yosemite issue "bash: fork: Resource temporarily unavailable"
# see the current limits
$ sysctl -a | grep maxproc
# increase it
$ sudo sysctl -w kern.maxproc=xxxx
$ sudo sysctl -w kern.maxprocperuid=xxx
# run at startup
$ sudo vim /etc/sysctl.conf
@zinbers
zinbers / README.md
Created August 2, 2017 06:07 — forked from brennanMKE/README.md
Check Bitcode support with Static Libraries

Check Bitcode

It is important to enable Bitcode in all libraries if the app is going to enable Bitcode. These scripts check each static library for Bitcode and echo a string which shows up as a warning in the build log. It is an easy way to always check that the dependencies have what is needed.

Usage

Place check_bitcode.sh in your project directory. Then add a Run Script in Build Phasese with the script named RunScript.sh. Name that new section as Check Bitcode and run the build. It may be necessary to make the shell script executble using chmod u+x check_bitcode.sh on the command-line.

Frameworks vs Static Libraries

@zinbers
zinbers / get_gv_loop.sh
Created July 19, 2017 12:15 — forked from Jiezhi/get_gv_loop.sh
replace your curl
for (( i=1; i>0; i++ ))
do
curl 'https://www.google.com/voice/b/0/service/post' -H 'origin: https://www.google.com' -H 'dnt: 1' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: zh-CN,zh;q=0.8,en;q=0.6' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36' -H 'content-type: application/x-www-form-urlencoded;charset=UTF-8' -H 'accept: */*' -H 'referer: https://www.google.com/voice/b/0' -H 'authority: www.google.com' -H 'cookie: gv=.........; GV_NR=1;-eVupmL6qR...........ncdG7vO' --data 'sid=...' --compressed
sleep 3s
done
@zinbers
zinbers / mouse_auto_click.py
Created July 19, 2017 11:32 — forked from Jiezhi/mouse_auto_click.py
auto click on screen
from pymouse import PyMouse
import time
m = PyMouse()
while True:
m.click(528, 800-196, 1)
time.sleep(3)
@zinbers
zinbers / README.md
Created July 5, 2017 08:05 — forked from rroblak/README.md
git diff image files on the command line, with color

This is a simple way to spot check that the modified image in your git index is the image you actually want without having to leave the command line.

Example: http://i.imgur.com/RUenUcM.png

Instructions

  1. Install git, ImageMagick, and jp2a via your favorite package manager.
  2. Put img-ascii-diff somewhere (e.g. ~/bin/img-ascii-diff).
  3. Put attributes in ~/.config/git/attributes.
  4. Modify ~/.gitconfig and add the lines below, pointing to wherever you put img-ascii-diff.
@zinbers
zinbers / resign-ipa.py
Created June 13, 2017 09:47 — forked from cybertk/resign-ipa.py
Resign ipa
#!/usr/bin/env python
# Copyright (c) 2013 Quanlong He. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
resign-ipa.py -- Resign the ipa with new certificate and mobileprovision.
"""
"""
@zinbers
zinbers / transfer.fish
Created May 11, 2017 05:51 — forked from nl5887/transfer.fish
Bash and zsh alias for transfer.sh. Transfers files and directories to transfer.sh.
function transfer
if test (count $argv) -eq 0
echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
end
## get temporarily filename, output is written to this file show progress can be showed
set tmpfile ( mktemp -t transferXXX )
## upload stdin or file
@zinbers
zinbers / gist:41690be8a08ea7831666bad14550e8fd
Created March 20, 2017 15:28 — forked from LordGaav/gist:4674198
Ugly Python hack to make SSL work properly with broken SSL servers and Ubuntu 12.04
try:
# Ugly hack to force SSLv3 and avoid
# urllib2.URLError: <urlopen error [Errno 1] _ssl.c:504: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error>
import _ssl
_ssl.PROTOCOL_SSLv23 = _ssl.PROTOCOL_TLSv1
except:
pass