Skip to content

Instantly share code, notes, and snippets.

Avatar
🎮

Chris Yip chrisyip

🎮
View GitHub Profile
@chrisyip
chrisyip / append-css-link-or-rule.js
Created Nov 29, 2011
Dynamically add CSS link or rule to DOM w/ pure JavaScript
View append-css-link-or-rule.js
View README.md
@chrisyip
chrisyip / for_global.txt
Last active Feb 19, 2020
SSLedge bypass list
View for_global.txt
127.0.0.1, anrdoezrs.net, *.anrdoezrs.net, w3ctech.com, *.w3ctech.com, hdtdxp.com, *.hdtdxp.com, uuzuonline.com, *.uuzuonline.com, luzhou.net, *.luzhou.net, cjphr.com, *.cjphr.com, fridaying.com, *.fridaying.com, bjokli.com, *.bjokli.com, 93txt.com, *.93txt.com, robotplayer.com, *.robotplayer.com, upai99.com, *.upai99.com, gemsky.net, *.gemsky.net, 00base.com, *.00base.com, mebi9t.com, *.mebi9t.com, is686.com, *.is686.com, cdncache.org, *.cdncache.org, sucaitianxia.com, *.sucaitianxia.com, 89178.com, *.89178.com, 5dmail.net, *.5dmail.net, oy66.com, *.oy66.com, shanghaining.com, *.shanghaining.com, book118.com, *.book118.com, zsbeike.com, *.zsbeike.com, hunantv.com, *.hunantv.com, ylunion.com, *.ylunion.com, mysilu.com, *.mysilu.com, 0737mp.com, *.0737mp.com, 37cu.com, *.37cu.com, longre.com, *.longre.com, yanzheng.com, *.yanzheng.com, lifeyoyo.com, *.lifeyoyo.com, wulinyingxiong.net, *.wulinyingxiong.net, yong9.net, *.yong9.net, communicatte.com, *.communicatte.com, ok92.net, *.ok92.net, junshishu.com, *.juns
@chrisyip
chrisyip / .zshrc
Created Mar 14, 2017
Zsh: auto run `nvm use` if `.nvmrc` exists
View .zshrc
function auto_nvm () {
if command -v nvm >/dev/null && [[ -a .nvmrc ]]; then
nvm use
fi
}
chpwd_functions=(${chpwd_functions[@]} "auto_nvm")
auto_nvm
@chrisyip
chrisyip / c_works_no.md
Last active Feb 12, 2018
Fix Yosemite issues
View c_works_no.md

If you encounter errors like this configure: error: C compiler cannot create executables, try this command on Terminal:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.10.xctoolchain

You should change XcodeDefault.xctoolchain and OSX10.10.xctoolchain tu suit your case.

View offscreen_preload.js
window.onload = function(){
var doc = document
, img = doc.createElement('img')
, div = doc.createElement('div')
, body = doc.getElementsByTagName('body')[0];
img.className = 'preload';
img.style.cssText = ';position:absolute;top:-999em;left:-999em;width:0;height:0;visibility:hidden;';
// ajax loaded or predefined img list
var arr = imgList
, str
@chrisyip
chrisyip / ac.js
Created Jul 14, 2017
async vs co
View ac.js
'use strict'
console.log('Using node %s', process.versions.node)
function p () {
return Promise.resolve('hello').then(s => `${s} world`)
}
const a = async function () {
await p()
@chrisyip
chrisyip / encrypt-decrypt.js
Last active Jul 6, 2017 — forked from adrianbravo/encrypt-decrypt.js
Basic Node.js crypto cipher/decipher example.
View encrypt-decrypt.js
'use strict'
const crypto = require('crypto')
const key = 'salt_from_the_user_document'
const plaintext = '56d008a27c36552a0f97b291'
const cipher = crypto.createCipher('aes-256-cbc', key)
const decipher = crypto.createDecipher('aes-256-cbc', key)
let encryptedPassword = cipher.update(plaintext, 'utf8', 'base64')
encryptedPassword += cipher.final('base64')
@chrisyip
chrisyip / aria2.conf
Created Jun 11, 2017
aria2 on R7500v2
View aria2.conf
# Aria2 configuration
# RPC Setting
enable-rpc=true
rpc-listen-all=true
rpc-allow-origin-all=true
rpc-listen-port=6800
rpc-secret=aria2_secret
# General Setting
View docs.json
[{"name":"Angular","slug":"angular~2_typescript","type":"angular","links":{"home":"https://angular.io/","code":"https://github.com/angular/angular"},"version":"2 TypeScript","release":"2.4.7","mtime":1487432703,"db_size":3380979},{"name":"Angular","slug":"angular~2_dart","type":"angular","links":{"home":"https://angular.io/","code":"https://github.com/angular/angular"},"version":"2 Dart","release":"2.2.4","mtime":1480870302,"db_size":3538959},{"name":"Angular.js","slug":"angularjs~1.6","type":"angularjs","version":"1.6","release":"1.6.3","mtime":1489347998,"db_size":1698263},{"name":"Angular.js","slug":"angularjs~1.5","type":"angularjs","version":"1.5","release":"1.5.11","mtime":1487432576,"db_size":1668313},{"name":"Angular.js","slug":"angularjs~1.4","type":"angularjs","version":"1.4","release":"1.4.14","mtime":1476633905,"db_size":1444683},{"name":"Angular.js","slug":"angularjs~1.3","type":"angularjs","version":"1.3","release":"1.3.20","mtime":1469290315,"db_size":1313532},{"name":"Angular.js","slug":"angul