Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block harrytallbelt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
harrytallbelt /
Last active Nov 8, 2017
Create a local bare repo, you can (put in Dropbox folder) use like remote.
# Create a new bare repo.
cd origin-parh
mkdir repo.git
cd repo.git
git --bare init
# Make an already existing repo bare.
cd origin-parh
mkdir repo
cd repo
harrytallbelt /
Created Oct 31, 2017
helpful bash commands
# count lines in all inner js files of a project
cat `find . | grep -v 'node_modules' | grep '.*.js$'` | wc -l
# list all the js files that contain a word
grep -v 'node_modules' | grep '.*.js$' | xargs grep 'SEARCHWORD' -l
harrytallbelt / matrix.js
Created Oct 25, 2017
A satisfying Matrix effect with Node.JS.
View matrix.js
const LINE_WIDTH = 80 // 150
const FRAMERATE = 100
console.log('\x1b[32m') // green text
console.log('\x1b[40m') // black bg
let line = []
for (let i = 0; i < LINE_WIDTH / 2; ++i) {
harrytallbelt / format-simplify.js
Created Oct 6, 2017
A bit of code for pretty formatting Simplify predicates. It can be used to parse and format s-lists if you throw a few lines out
View format-simplify.js
// Indentation unit: predicate components are indented with this string,
// repeated several times, depending on their nesting level.
// Use '' for no identation.
// All lines end with this string; predicates on the top level
// are separated with twice this string.
// Use ' ' for a one-line output ('' won't lead to valid predicates).
// An s-list shorter than this would be a one-liner.
// This number is not exact, though (see `estimatedLength`).
harrytallbelt /
Created Mar 20, 2017
Bash script to convert coloured photos to (much smaller) grayscale using imagemagick package.
mkdir results
for image in *.jpg
convert -colorspace Gray -interlace Plane -gaussian-blur 0.05 -quality 50% $image ./results/$image
harrytallbelt / waterCapacity.fs
Created May 18, 2016
F# solution for water on land problem
View waterCapacity.fs
let oneWayCapacity a =
let mutable max = 0
a |> (fun e -> if e > max then max <- e; 0 else max - e)
let totalCapacity a =
let aL = a |> oneWayCapacity
let aR = a |> List.rev |> oneWayCapacity |> List.rev
List.map2 min aL aR |> List.sum
You can’t perform that action at this time.