Skip to content

Instantly share code, notes, and snippets.

@debjitbis08
debjitbis08 / install-dots.sh
Last active May 12, 2020 13:23
Install my dots
sudo apt install fish
chsh -s `which fish`
sudo apt install git
git clone --bare https://github.com/debjitbis08/dots.git $HOME/.cfg
function config {
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
}
mkdir -p .config-backup
config checkout
if [ $? = 0 ]; then
@debjitbis08
debjitbis08 / doubleEveryOther.js
Last active August 29, 2015 14:06
Double every other
var zipWith = function (fn, a, b) {
var l = Math.min(a.length, b.length),
r = [];
for(var i = 0; i < l; i += 1) {
r.push(fn(a[i], b[i]));
}
return r;
};
var mul = function (a, b) { return a * b; }
function AsyncA(cps) {
this.cps = cps;
}
AsyncA.prototype.AsyncA = function () {
return this;
};
AsyncA.prototype.next = function (g) {
var f = this;
g = g.AsyncA();
@debjitbis08
debjitbis08 / rng.js
Last active December 15, 2015 17:18
Portable random number generator recommended in Seminumerical Algorithms. Ported from http://www-cs-faculty.stanford.edu/~uno/programs/rng-double.c
(function () {
var KK = 100;
var LL = 37;
var mod_sum = function (x, y) {
return x+y-(x+y|0);
};
var ran_u = Array(KK);
@debjitbis08
debjitbis08 / 8085.pegjs
Last active December 14, 2015 04:19
PEG.js file for the 8080/8085 assembly language
{
var machineCode = [];
var symbolTable = {};
var ilc = 0;
var mnemonics = {
"nop" : {code:0x00,size:1},
"lxi b,d16" : {code:0x01,size:3},
"stax b" : {code:0x02,size:1},
"inx b" : {code:0x03,size:1},
"inr b" : {code:0x04,size:1},
@debjitbis08
debjitbis08 / bindReady.js
Created September 25, 2012 09:17
Bind Ready function based on jQuery 1.8.2 code.
var bindReady = function (d) {
function callback() {
if (this.isReady) {
return;
}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( callback, 1 );
}