Skip to content

Instantly share code, notes, and snippets.

@zanedeg
zanedeg / aync.js
Created June 1, 2018 00:10
NodeJS async comparisons
'use strict';
const promisify = require('util').promisify;
const delay = (interval, cb) => {
console.log(`Waiting ${interval}s`);
setTimeout(() => cb(null, interval), interval);
}
const delayAsync = promisify(delay);
@zanedeg
zanedeg / json_dump.js
Last active July 26, 2016 22:12
Dump json file of query from mongo
// npm install mongodb
// node json_dump.js
var fs = require('fs');
var mongo = require('mongodb').MongoClient;
var ObjectID = require('mongodb').ObjectID
var config = {
user: "",
password: "",
@zanedeg
zanedeg / fizzbuzz.js
Created January 24, 2016 00:35
FizzBuzz without loops and only ternary operators
function fizzbuzz(str, next) {
var iterVal = next % 3 === 0 ? 'Fizz' : '';
iterVal += next % 5 === 0 ? 'Buzz' : '';
str += iterVal ? iterVal : next;
return next > 99 ? str : fizzbuzz(str + ',', next + 1);
}
console.log(fizzbuzz("",1));
@zanedeg
zanedeg / removeAll.sh
Created December 3, 2015 19:23
Docker One Liners
docker rm $(docker ps -a -q)
@zanedeg
zanedeg / keybase.md
Created September 26, 2014 02:02
keybase.md

Keybase proof

I hereby claim:

  • I am zanedeg on github.
  • I am zanedeg (https://keybase.io/zanedeg) on keybase.
  • I have a public key whose fingerprint is 8B45 4B11 5008 56B4 ACA6 D56C B35F FB0F CCBD 3567

To claim this, I am signing this object:

@zanedeg
zanedeg / zanedeg.zsh-theme
Last active May 10, 2018 22:39
Custom oh-my-zsh theme
# font: https://github.com/tonsky/FiraCode
# theme: Base16 Eighties
local usr='%F{grey}%n%f'
local dir='%F{blue}%~%f'
local git='$(git_prompt_info)%f'
PROMPT="╭─ ${usr} ${dir} ${git}
╰─%B$%b "
@zanedeg
zanedeg / AWS keypair Ref
Last active August 29, 2015 14:05
Generate and upload a new keypair to AWS
ssh-keygen -q -t rsa -f ~/.ssh/[keyname -N '' -C [keyname]
aws ec2 import-key-pair --key-name [keyname] --public-key-material file://~/.ssh/[keyname].pub
# Stolen from https://github.com/deis/deis/tree/master/contrib/ec2