This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(typeof module !== "undefined") { | |
module.exports = Color; | |
} else { | |
this.Color = Color; | |
} | |
function Color() { | |
var r,g,b; | |
if(arguments.length === 1) { | |
var hexa = arguments[0].toLowerCase(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var EventEmitter = function() { | |
this._events = {}; | |
}; | |
EventEmitter.prototype.on = function(evtn, fn) { | |
if(!this._events.hasOwnProperty(evtn)) this._events[evtn] = []; | |
this._events[evtn].push(fn); | |
}; | |
EventEmitter.prototype.off = function(evtn, fn) { | |
if(!this._events.hasOwnProperty(evtn)) return; | |
var idx = this._events[evtn].indexOf(fn); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RateLimit = function(interval_ms) { | |
this._interval_ms = interval_ms || 0; // (0 means no limit) | |
this._after = 0; | |
}; | |
RateLimit.prototype.attempt = function(time) { | |
var time = time || Date.now(); | |
if(time < this._after) return false; | |
this._after = time + this._interval_ms; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// educational node bitcoin getwork pool cpu mining | |
var request = require('request'); | |
var crypto = require('crypto'); | |
var json_rpc_id = 1; | |
function sha256(buf) { | |
var sha = crypto.createHash('sha256'); | |
sha.update(buf); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pactl load-module module-null-sink sink_name=from_apps sink_properties=device.description="from_apps" | |
pactl load-module module-null-sink sink_name=to_rec sink_properties=device.description="to_rec" | |
pactl load-module module-loopback source=alsa_output.pci-0000_00_10.1.analog-stereo.monitor sink=to_rec | |
pactl load-module module-loopback source=from_apps.monitor sink=to_rec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Bufferer = function() { | |
this.buffer = new Buffer(0); | |
this.expects = []; | |
return this; | |
}; | |
Bufferer.prototype.receive = function(buffer) { | |
var new_buffer = new Buffer(this.buffer.length + buffer.length); | |
this.buffer.copy(new_buffer); | |
buffer.copy(new_buffer, this.buffer.length); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var net = require("net"); | |
var Proxy = function() { | |
}; | |
Proxy.to = function(dst_host, dst_port) { | |
var proxy = new Proxy(); | |
proxy.dstHost = dst_host; | |
proxy.dstPort = dst_port; | |
proxy.mid = []; | |
return proxy; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem dir *.java /s /B > sources_list.txt | |
javac -classpath "${CLASSPATH}" @sources_list.txt | |
pause | |
jar cmf META-INF/MANIFEST.MF test.jar * | |
pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.downloadImage = function(url, cb) { | |
var img = new Image(); | |
img.onerror = function() { | |
cb("onerror", img); | |
}; | |
img.onabort = function() { | |
cb("onabort", img); | |
}; | |
img.onload = function() { | |
cb(false, img); |
NewerOlder