Skip to content

Instantly share code, notes, and snippets.

@SAPikachu
SAPikachu / gist:a2a5a572ad376288b442
Created November 14, 2014 03:45
广州电信劫持一号店请求
GET http://www.yhd.com/ HTTP/1.1
Host: www.yhd.com
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.7,zh-cn;q=0.3
Accept-Encoding: gzip, deflate
Cookie: abtest=56; provinceId=20; gla=20.237_0; _ga=GA1.2.84242378.1415496467; guid=PTV1EPTMGSE39YQRUWDNF8CJ4HJCZHF16WMG; tma=40580330.17223687.1415496470262.1415496470262.1415496470262.1; tmd=4.40580330.17223687.1415496470262.; wide_screen=1; search_browse_history=31087315%2C9751673; gc=93805155%2C29798229; grouponAreaId=37; uname=%E8%83%A1%E5%B9%BF%E6%98%8E; yihaodian_uid=121197816; cart_num=0; pms_cart=33841551x85081x1; __utma=40580330.84242378.1415496467.1415666972.1415666972.1; __utmz=40580330.1415666972.1.1.utmcsr=t.yhd.com|utmccn=(referral)|utmcmd=referral|utmcct=/detail/1110174
Connection: keep-alive
@SAPikachu
SAPikachu / README.md
Created January 27, 2014 02:47
OpenVPN/6in4 tunnel over IPSec (alpha)
  • Draft, very hard to configure and use
  • Don't ask me how to use it at this moment, once it matures I will move it to a repository and add instructions.
  • Remember to run ip xfrm state flush && ip xfrm policy flush after changing configuration and before re-running easy-ipsec.py
  • Requirements:
    • Linux
    • iproute2
    • dig
    • Python 2.7
  • PyCrypto
@SAPikachu
SAPikachu / custom-convert.conf
Created January 2, 2014 12:37
Logitech Media Server hack * Tracks in single-file FLAC+CUE albums can be played individually * Transcode APE to FLAC since APE support is not very good
# $Id$
#
# Configuration file for transcoding
#
# If you wish to create custom transcoding entries that won't be overwritten
# by a new release of Logitech Media Server, create a custom-convert.conf file in the
# Logitech Media Server root directory, or the root of the Plugins directory.
#
# On Debian, you can also create this file in # /etc/slimserver/custom-convert.conf
#
#!/usr/bin/env python3
# Prerequisite: pypng (https://github.com/drj11/pypng)
# Issue: Converted images don't work well with \fad
# Test environment: i5-520M, 8GB memory, Radeon 5650M
# Image size: 345 x 164, more than 80% pixels are not fully transparent
# Video: H264 10bit, 1920 x 1080, ~4Mbps
# Software:
@SAPikachu
SAPikachu / kwacros.py
Last active December 14, 2015 13:59 — forked from skyl/kwacros.py
Make {% loadkwacros %} be able to use variables and filters
#
# templatetags/kwacros.py - Support for macros in Django templates
#
# Based on snippet by
# Author: Michal Ludvig <michal@logix.cz>
# http://www.logix.cz/michal
#
# modified for args and kwargs by Skylar Saveland http://skyl.org
#
@SAPikachu
SAPikachu / README.md
Last active December 11, 2015 18:19
Enable / disable individual adbd service on phone

Compiling

Apply the patch to android_system_core repository (located at <android source root>/system/core for CM10), then compile as usual.

Usage

In root shell, use setprop [persist.]sys.adbse.<service name> <0/1> to toggle adb services. It will be immediately effective to new adb connections. Existing connections won't be affected.

import os
import re
from glob import glob
import random
import string
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib.project import rsync_project
*We will issue you a credit for one month's value of the following plans that you own that had at least one active or published site as of September 10, 2012: Web Hosting, WordPress Blog Hosting, Website Builder, Quick Shopping Cart, Dream Design Team Website Design or Web Store Design, Dedicated or Virtual Dedicated Servers, CashParking, or any paid email account (Web-based or Hosted Exchange).
import sys
import os
import shutil
import zipfile
def run():
encoding_name = sys.argv[1]
path = len(sys.argv) > 3 and sys.argv[3] or ""
z = zipfile.ZipFile(sys.argv[2])
for info in z.infolist():
@SAPikachu
SAPikachu / gist:3044311
Created July 4, 2012 00:16
Scenecut glitch detect
raw = last
RemoveGrain(mode=19)
denoised = last
super = MSuper()
vectors = MAnalyse(super, isb=false, delta=1, search=5, chroma=false)
mask = MMask(vectors,thscd1=100).Grayscale()
raw