This file contains 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
#!/usr/bin/env zsh | |
playlistUrl="$1"; | |
numParallelDownloads="${2:-5}"; | |
numParallelFragments="${3:-5}"; | |
[[ -z "$playlistUrl" ]] && echo 'i need a url to a yt playlist please.' >&2 && exit 1; | |
[[ "$numParallelDownloads" =~ '^[^0-9]+$' ]] && echo "expected parameter 2 to be the number of parallel downloads, got '$numParallelDownloads'." >&2 && exit 1; | |
[[ "$numParallelFragments" =~ '^[^0-9]+$' ]] && echo "expected parameter 3 to be the number of parallel fragments, got '$numParallelFragments'." >&2 && exit 1; |
This file contains 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
#!/usr/bin/env zsh | |
# usage: docker-machine-rename default my-default | |
function docker-machine-rename { | |
oldName="$1"; | |
newName="$2"; | |
[ -z "$oldName" -o -z "$newName" ] && echo "Must specify both the old and new machine names" && return 2; | |
storePathRoot=$(docker-machine inspect -f '{{ .Driver.StorePath }}' "$oldName"); |
This file contains 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
# for Ubuntu 16.10 GNOME 3.20 | |
# on dell precision 5520 | |
# configured against http://github.com/bulletmark/libinput-gestures rev d0bf9e0 | |
# see https://wiki.gnome.org/Design/OS/KeyboardShortcuts | |
# expo equivalent toggle | |
gesture swipe up 3 xdotool key super | |
gesture swipe down 3 xdotool key super | |
# browser back/forward |
This file contains 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 C = function C(a,b) { | |
this.a = a||''; | |
this.b = b||''; | |
}; | |
Object.defineProperties(C.prototype,{ | |
a: { | |
configurable: true, | |
enumerable: true, | |
get: function() { |
This file contains 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 MongoClient = require('mongodb').MongoClient; | |
MongoClient.connect('mongodb://localhost/fromdb',function(err,dbLocal) { | |
if ( err ) throw err; | |
MongoClient.connect('mongodb://remotehost/todb',function(err,dbRemote) { | |
if ( err ) throw err; | |
var collectionLocal = dbLocal.collection('fromcollection'), | |
collectionRemote = dbRemote.collection('tocollection'), | |
queryLocal = {field:'value'}; | |
collectionLocal.find(queryLocal).each(function(err,docLocal) { |
This file contains 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
/* | |
* filename: index.js | |
* run: node--debug-brk index.js | |
* tested in node v0.10.30 | |
*/ | |
global.v8debug.Debug.setBreakOnException(); // enable it, global.v8debug is only defined when --debug flag is set | |
setTimeout(function() { | |
bogus(); // should break here, "`bogus` is not defined" | |
},2000); |
This file contains 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 bson = require('bson').BSONPure; | |
var str = 'привет'; | |
var buf = new Buffer(str); | |
console.log({ | |
str: str, // 'привет' | |
buf: buf, // <Buffer d0 bf d1 80 d0 b8 d0 b2 d0 b5 d1 82> | |
strLen: str.length, // 6 | |
bufLen: buf.length, // 12 | |
bufBytes: Buffer.byteLength(str,'utf8'), // 12 |
This file contains 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
<NotepadPlus> | |
<UserLang name="Jade" ext="jade" udlVersion="2.1"> | |
<Settings> | |
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" /> | |
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="yes" Keywords5="yes" Keywords6="yes" Keywords7="no" Keywords8="no" /> | |
</Settings> | |
<KeywordLists> | |
<Keywords name="Comments">03/* 04*/ 00// 00//- 01 02</Keywords> | |
<Keywords name="Numbers, prefix1"></Keywords> | |
<Keywords name="Numbers, prefix2"></Keywords> |