Skip to content

Instantly share code, notes, and snippets.

View nickleefly's full-sized avatar

Xiuyu Li nickleefly

  • Shanghai
View GitHub Profile
@nickleefly
nickleefly / leveldb.js
Created January 26, 2015 02:59
read a list of data from levelup
var mkdirp = require('mkdirp')
var path = require('path')
var HOME = process.env.HOME
var dir = path.join(HOME, 'dprk.db')
mkdirp.sync(dir)
var db = require('levelup')(dir, {encoding: 'json'})
db.put(
'dprk'
, {
@nickleefly
nickleefly / .zshrc
Last active August 29, 2015 14:14 — forked from SlexAxton/.zshrc
gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@nickleefly
nickleefly / .proxychains.conf
Last active August 29, 2015 14:15
proxychains
strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
quiet_mode
[ProxyList]
socks5 127.0.0.1 1080
@nickleefly
nickleefly / GIF-Screencast-OSX.md
Last active August 29, 2015 14:16 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

Keybase proof

I hereby claim:

  • I am nickleefly on github.
  • I am nickleefly (https://keybase.io/nickleefly) on keybase.
  • I have a public key whose fingerprint is 0AFD 9D6A F5D9 9F70 5E95 913B B28E 7EC0 B478 99EB

To claim this, I am signing this object:

@nickleefly
nickleefly / nextTick.js
Created August 1, 2012 05:10 — forked from mmalecki/nextTick.js
process.nextTick vs setTimeout(fn, 0)
for (var i = 0; i < 1024 * 1024; i++) {
process.nextTick(function () { Math.sqrt(i) } )
}
@nickleefly
nickleefly / readme-outline.md
Created October 9, 2012 16:22 — forked from indexzero/readme-outline.md
A quick outline of a README.md

README.md Outline

  • Header and a Brief description (should match package.json)
  • Example (if applicable)
  • Motivation (if applicable)
  • API Documentation: This will likely vary considerably from library to library.
  • Installation
  • Tests
  • Contributors
  • License
@nickleefly
nickleefly / 1-view-events.js
Created October 13, 2012 14:58 — forked from mxriverlynn/1-view-events.js
zombies! run!
MyView = Backbone.View.extend({
events: {
"click #someButton": "doThat",
"change #someInput": "changeIt"
},
doThat: function(){ ... },
changeIt: function(){ ... }
});
function runSpecs() {
// configure the spec runner
var specRunner = new Hilo.SpecRunner({
src: "Hilo",
specs: "specs",
helpers: "specs/Helpers"
});
// Handle any errors in the execution that
// were not part of a failing test
@nickleefly
nickleefly / promises.md
Created October 25, 2012 04:45 — forked from domenic/promises.md
You're Missing the Point of Promises

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
    // the rest of your code goes here.
});