Skip to content

Instantly share code, notes, and snippets.

View hankbao's full-sized avatar
🧠
use it or lose it

Hank Bao hankbao

🧠
use it or lose it
View GitHub Profile
if (typeof (AC) === "undefined") {
AC = {}
}
AC.ImageReplacer = Class.create({
_defaultOptions: {
listenToSwapView: true,
filenameRegex: /(.*)(\.[a-z]{3}($|#.*|\?.*))/i,
filenameInsert: "_☃x",
ignoreCheck: /(^http:\/\/movies\.apple\.com\/|\/105\/|\/global\/elements\/quicktime\/|_(([2-9]|[1-9][0-9]+)x|nohires)(\.[a-z]{3})($|#.*|\?.*))/i,
attribute: "data-hires",
//
// RVNReceiptValidation.m
//
// Created by Satoshi Numata on 12/06/30.
// Copyright (c) 2012 Sazameki and Satoshi Numata, Ph.D. All rights reserved.
//
// This sample shows how to write the Mac App Store receipt validation code.
// Replace kRVNBundleID and kRVNBundleVersion with your own ones.
//
// This sample is provided because the coding sample found in "Validating Mac App Store Receipts"
@hankbao
hankbao / Fuckgfw.conf
Created October 12, 2015 13:47 — forked from jason5ng32/surge.conf
Surge Config
[General]
loglevel = notify
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12,127.0.0.0/24
[Proxy]
// ADD YOUR PROXY HERE, DON'T FORGET TO REMOVE #
# Proxy = http,$IP,$PORT,$USERNAME,$PASSWORD
# Proxy = https,$IP,$PORT,$USERNAME,$PASSWORD
@hankbao
hankbao / sudoku.hs
Created October 30, 2015 19:37 — forked from kristopherjohnson/sudoku.hs
Sudoku solver in Haskell
#!/usr/bin/env runhaskell
-- Note: For a slight improvement in performance, import the non-portable
-- Data.Array.Unboxed module instead of Data.Array, and change the Board
-- type below to use "UArray" instead of "Array".
import Data.Array
-- Solve the example puzzle specified below
-- TODO: read puzzle from input
main = do
@hankbao
hankbao / Breakpoints_v2.xcbkptlist
Created July 14, 2017 02:40 — forked from Ashton-W/Breakpoints_v2.xcbkptlist
My User Breakpoints_v2.xcbkptlist
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "2"
version = "2.0">
<Breakpoints>
<!-- All Exceptions -->
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
@hankbao
hankbao / HopperVCppDemangler.py
Created September 3, 2017 16:23 — forked from thomasfinch/HopperVCppDemangler.py
A super crappy and kinda slow (it makes network calls!) Visual C++ demangler script for Hopper disassembler. Based on https://github.com/melomac/Hopper/blob/master/Demangle%20Swift.py, uses demangler.com
import urllib, urllib2
def demangle(symbol):
r = urllib2.Request('http://demangler.com/raw', urllib.urlencode({'input': symbol}))
response = urllib2.urlopen(r)
return response.read()
def main():
doc = Document.getCurrentDocument()
current = doc.getCurrentAddress()
'''
Break on Objective-C 's method using its address'
'''
import shlex
import lldb
import re
def breakonmethod(debugger, command, exe_ctx,result, internal_dict):
args=shlex.split(command)
Class=args[0]
Method=args[1]
@hankbao
hankbao / Makefile
Last active February 21, 2018 03:22 — forked from lenew/Makefile
Realtek r8168 kernel module for OpenWRT or LEDE
#Download realtek r8168 linux driver from official site [http://www.realtek.com/downloads/downloadsView.aspx?PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3]
#Unpack source file
#Replace orginal Makefile with this file
#Put this source to 'package' folder of OpenWRT/LEDE SDK
#Build(make menuconfig, make defconfig, make)
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=r8168
@hankbao
hankbao / PracticalSocket.cpp
Created May 5, 2019 03:34 — forked from ardeshir/PracticalSocket
PracticalSocket.cpp
/*
* C++ sockets on Unix and Windows
* Copyright (C) 2002
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@hankbao
hankbao / PracticalSocket.h
Created May 5, 2019 03:34 — forked from ardeshir/PracticalSocket.h
PracticalSocket.h
/*
* C++ sockets on Unix and Windows
* Copyright (C) 2002
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,