Skip to content

Instantly share code, notes, and snippets.


Austin Lee lizheming

View GitHub Profile
p4bl0- /
Last active Aug 17, 2022
A complete compiler for a simple language (in less than 150 LoC)

This project is a tiny compiler for a very simple language consisting of boolean expression.

The language has two constants: 1 for true and 0 for false, and 4 logic gates: ! (not), & (and), | (or), and ^ (xor).

It can also use parentheses to manage priorities.

Here is its grammar in BNF format:

expr ::= "0" | "1"

messense /
Last active Jul 17, 2019
shadowsocks on openwrt

配置 shadowsocks

架设好 shadowsocks 服务端,在路由器上安装 shadowsocks 客户端,并配置 /etc/config/shadowsocks.json ,假设本地监听端口为 1080 。启动 shadowsocks

/etc/init.d/shadowsocks start

配置 privoxy

安装 privoxy openwrt 版。

anonymous / hash.php
Created Mar 27, 2013
View hash.php
* 加密 hash,生成发送给用户的 hash 字符串
* @param array $hash_data
* @param string $hash_key
* @return string
function encode_hash($hash_data, $hash_key = false)
brettz9 / HTMLSelectElement.prototype.selectedOptions.js
Last active Jul 25, 2019
selectedOptions shim (multiple select) with IE8 support
View HTMLSelectElement.prototype.selectedOptions.js
* Polyfill for "fixing" IE's lack of support (IE < 9) for applying slice
* on host objects like NamedNodeMap, NodeList, and HTMLCollection
* (technically, since host objects are implementation-dependent,
* IE doesn't need to work this way). Also works on strings,
* fixes IE to allow an explicit undefined for the 2nd argument
* (as in Firefox), and prevents errors when called on other
* DOM objects.
* @license MIT, GPL, do whatever you want
-* @see
remy / audiosprite.js
Created Dec 23, 2010
An example of how an audio sprite can be used (includes fixes for iOS)
View audiosprite.js
function Track(src, spriteLength, audioLead) {
var track = this,
audio = document.createElement('audio');
audio.src = src;
audio.autobuffer = true;
audio.muted = true; // makes no difference on iOS :(
/* This is the magic. Since we can't preload, and loading requires a user's
input. So we bind a touch event to the body, and fingers crossed, the