Skip to content

Instantly share code, notes, and snippets.

View pright's full-sized avatar

Jun Xie pright

  • Shanghai, China
View GitHub Profile
@pright
pright / msys2-sshd-setup.sh
Created November 11, 2019 08:25 — forked from samhocevar/gist:00eec26d9e9988d080ac
Configure sshd on MSYS2 and run it as a Windows service
#!/bin/sh
#
# msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service
#
# Please report issues and/or improvements to Sam Hocevar <[email protected]>
#
# Prerequisites:
# — MSYS2 itself: http://sourceforge.net/projects/msys2/
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
#
@pright
pright / example.py
Created November 12, 2016 09:06
how to interrupt multiprocessing.Pool gently...
import multiprocessing
import time
import os
import signal
def init_worker():
signal.signal(signal.SIGINT, signal.SIG_IGN)
@pright
pright / 00-README.txt
Created October 11, 2016 07:00 — forked from klzgrad/00-README.txt
DNS compression pointer mutation
$ LD_PRELOAD=$PWD/sendmsg.so dig twitter.com @8.8.8.8
;; Warning: Message parser reports malformed message packet. <-- malformed 因为把压缩指针当作域名一部分了
;; Question section mismatch: got twitter.com/RESERVED0/CLASS256
; <<>> DiG 9.9.5-3-Ubuntu <<>> twitter.com @8.8.8.8
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44722
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
@pright
pright / zimuzu-sign.sh
Last active September 17, 2015 05:09 — forked from 599316527/zimuzu-sign.sh
zimuzu.tv 签到脚本
#!/bin/bash
ACCOUNT=""
PASSWORD=""
#########################################
function urlEncode() {
python -c "
import urllib, commands, os;
#!/usr/bin/env python
import sys
import string
import struct
if len(sys.argv) <= 1:
print 'Usage: %s [filename]' % __file__
sys.exit()
@pright
pright / push.sh
Created September 28, 2014 02:39
#! /bin/sh
if [ "x$TARGET_PRODUCT" == x ]; then
echo "TARGET_PRODUCT not set!"
exit 1
fi
let TIME_RANGE=5
if [ $# -eq 1 ]; then
TIME_RANGE=$1
@pright
pright / imap.py
Last active December 23, 2015 22:29
imaplib
import imaplib
from pprint import pprint
user = 'USER'
password = 'PASSWORD'
imap = imaplib.IMAP4_SSL('imap.gmail.com', 993)
imap.login(user + '@gmail.com', password)
status, data = imap.list()
@pright
pright / utf7.py
Last active December 23, 2015 22:29
imap4_utf_7
# -*- coding: UTF-8 -*-
# vim: expandtab sw=4 ts=4 sts=4:
'''
Wammu - Phone manager
IMAP UTF-7 codec
'''
__author__ = 'Michal ?iha?'
__email__ = '[email protected]'
__license__ = '''
Copyright © 2003 - 2010 Michal ?iha?
@pright
pright / hexdump.py
Created September 23, 2013 15:31 — forked from 7h3rAm/hexdump.py
def hexdump(src, length=16, sep='.'):
FILTER = ''.join([(len(repr(chr(x))) == 3) and chr(x) or sep for x in range(256)])
lines = []
for c in xrange(0, len(src), length):
chars = src[c:c+length]
hex = ' '.join(["%02x" % ord(x) for x in chars])
if len(hex) > 24:
hex = "%s %s" % (hex[:24], hex[24:])
printable = ''.join(["%s" % ((ord(x) <= 127 and FILTER[ord(x)]) or sep) for x in chars])
lines.append("%08x: %-*s |%s|\n" % (c, length*3, hex, printable))