Skip to content

Instantly share code, notes, and snippets.

View arbitrary-dev's full-sized avatar
⚔️

arbitrary-dev

⚔️
  • Kingdom of God
View GitHub Profile
@arbitrary-dev
arbitrary-dev / es6-flatten.js
Last active January 10, 2017 03:55
Some code, that will flatten an array of arbitrarily nested arrays
// ECMAScript 6
const flatten = (arr) =>
// Reducer concat array items to accumulated result
// or recursively calls flatten again if the item is an array.
arr.reduce((acc, item) =>
acc.concat(Array.isArray(item) ? flatten(item) // recursively flatten nested array
: item), // concat ordinary item
[]); // init empty accumulator
@arbitrary-dev
arbitrary-dev / x
Created December 29, 2016 19:00
Xtract lines from file or input
# x 2,4 <file>
# printf <text> | x 4,$
sed -n $1p $2
@arbitrary-dev
arbitrary-dev / find-inodes
Last active December 29, 2016 19:01
Where my inodes at?
# find-inodes <path>
find $1 -xdev -printf '%h\n' | sort | uniq -c | sort -k1 -n | less
@arbitrary-dev
arbitrary-dev / ls-xargs-cnv
Last active December 29, 2016 18:39
Convert films in a batch
ls **/*.avi | xargs -d '\n' -n1 -I {} cnv film -b 500k -dn --log error {}
@arbitrary-dev
arbitrary-dev / cyrillic-chars.txt
Last active December 18, 2016 13:20
For use inside ~/.XCompose
Cyrillic_A = U+0410
Cyrillic_a = U+0430
Cyrillic_BE = U+0411
Cyrillic_be = U+0431
Cyrillic_CHE_descender = U+04B6
Cyrillic_che_descender = U+04B7
Cyrillic_CHE = U+0427
Cyrillic_che = U+0447
Cyrillic_CHE_vertstroke = U+04B8
Cyrillic_che_vertstroke = U+04B9