=====
I made a book, its one page.
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then | |
// use window.btoa' step. According to my tests, this appears to be a faster approach: | |
// http://jsperf.com/encoding-xhr-image-data/5 | |
/* | |
MIT LICENSE | |
Copyright 2011 Jon Leighton | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
#Refer: http://www.linuxfoundation.org/collaborate/workgroups/networking/netem#Delaying_only_some_traffic | |
#Refer: http://www.bomisofmab.com/blog/?p=100 | |
#Refer: http://drija.com/linux/41983/simulating-a-low-bandwidth-high-latency-network-connection-on-linux/ | |
#Setup the rate control and delay | |
sudo tc qdisc add dev lo root handle 1: htb default 12 | |
sudo tc class add dev lo parent 1:1 classid 1:12 htb rate 56kbps ceil 128kbps | |
sudo tc qdisc add dev lo parent 1:12 netem delay 200ms | |
#Remove the rate control/delay | |
sudo tc qdisc del dev lo root |
# Autocomplete from current tmux screen buffer | |
_tmux_pane_words() { | |
local expl | |
local -a w | |
if [[ -z "$TMUX_PANE" ]]; then | |
_message "not running inside tmux!" | |
return 1 | |
fi | |
w=( ${(u)=$(tmux capture-pane \; show-buffer \; delete-buffer)} ) | |
_wanted values expl 'words from current tmux pane' compadd -a w |
#! /usr/bin/env bash | |
PLAYER='vlc' | |
lsof -nP -S2 -bw -u $UID|\ | |
awk '/\/tmp\/Flash/ { gsub("[^0-9]","",$4); print "/proc/"$2"/fd/"$4 }'|\ | |
xargs ${PLAYER} |
=====
I made a book, its one page.
# from http://funcall.blogspot.sg/2009/03/not-lisp-again.html | |
def deriv(f, dx=.0001): | |
return lambda x: (f(x + dx) - f(x)) / dx | |
cube = lambda x: x**3 | |
d = deriv(cube) | |
for n in xrange(5): | |
print n, d(n) |
// UTF8 Module | |
// | |
// Cleaner and modularized utf-8 encoding and decoding library for javascript. | |
// | |
// copyright: MIT | |
// author: Nijiko Yonskai, @nijikokun, nijikokun@gmail.com | |
(function (name, definition, context, dependencies) { | |
if (typeof context['module'] !== 'undefined' && context['module']['exports']) { if (dependencies && context['require']) { for (var i = 0; i < dependencies.length; i++) context[dependencies[i]] = context['require'](dependencies[i]); } context['module']['exports'] = definition.apply(context); } | |
else if (typeof context['define'] !== 'undefined' && context['define'] === 'function' && context['define']['amd']) { define(name, (dependencies || []), definition); } | |
else { context[name] = definition.apply(context); } |
# Suppose the currenct directory is ~/develop | |
$ git clone https://github.com/redis/hiredis | |
$ cd hiredis | |
# Set emscripten compiling target | |
$ export EMCC_LLVM_TARGET=i386-pc-linux-gnu | |
# Locale the installation path of webruby, for example, on my mac this is: | |
# ~/.gem/ruby/2.0.0/gems/webruby-0.2.4/ |
Copyright © 2014 Jose Luis Rivas | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in |