Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
DEST=$2
if [[ -n $DEST ]]; then
nc -- $DEST
else
exit 1
fi
@darnould
darnould / gist:ae4d33c49b1a91fbd3c1
Last active February 21, 2020 16:14
Quick major/minor/patch bumping demo
bump_index = { "major" => 0, "minor" => 1, "patch" => 2 }
bump_type = ARGV[0]
bump_index.include?(bump_type) or abort "Usage: #{$0} major/minor/patch"
bump_start = bump_index[bump_type]
# Preset in this example
version = "1.2.3"
@darnould
darnould / gist:736b5a74f29025fa68aa
Last active August 29, 2015 14:15
Why we keep our code refactored nicely...

"Learning meta-rules is more difficult and time-consuming than learning procedural rules... Ontogenetically, social meta-learning follows the learning of procedural rules. This is comparable to the acquisition of language and memory use. Children first acquire examples of grammatically correct language (likeliked; stand-stood), then recognise the rules (if you need past tense, add -ed to the infinitive form) and go through a phase where they make 'errors' that they did not make before (stand-standed). Finally, they learn exceptions to the rule and rules governing exceptions."

"Machiavellian Intelligence II: Extensions and Evaluations", Whiten & Byrne.

This is why we keep our code refactored nicely.

@darnould
darnould / gist:bc4120b36ecf667149e5
Last active August 29, 2015 14:14
Merging PRs from forks (using squash)

Squash-merging PRs from forks

This example uses PR #2. Replaces all instances of 2 with the ID you're looking to merge (using squash).

  • git checkout master
  • git fetch origin pull/2/head:2
  • git merge --squash 2
  • git commit
  • git push
@darnould
darnould / gist:9c19d5581fbca4478acf
Created December 22, 2014 13:04
Tribler issue #1019 reproduced
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/vagrant/tribler/Tribler/Core/Utilities/twisted_thread.py", line 21, in _reactor_runner
reactor.run(installSignalHandlers=False)
File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1192, in run
self.mainLoop()
File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1201, in mainLoop
self.runUntilCurrent()
--- <exception caught here> ---