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
import sys | |
from functools import cmp_to_key | |
def p(data, label=None): | |
if label: | |
print(label, end=": ", file=sys.stderr) | |
print(data, file=sys.stderr) | |
return data |
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
# GNU Make 4.1 | |
# the next line has no trailing whitespace | |
A=a | |
B=a# no whitespace before the comment | |
C=a # some whitespace before the comment | |
# the next line has some trailing whitespace | |
D=a | |
default: |
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
abstract class Beither[+A, +B] { | |
// From German "beide" and English "either" => "beither". | |
// Preferably pronounced as German "Beißer". | |
def left = Beither.LeftProjection(this) | |
def right = Beither.RightProjection(this) | |
def both = Beither.BothProjection(this) | |
} |
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
#!/bin/bash | |
# Original: https://gist.github.com/helderco/e9d8d072a362ad818f6a | |
set -e | |
show_help() { | |
cat << EOF | |
Usage: ${0##*/} [-s SERV] [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE] | |
${0##*/} -h |
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
source 'https://rubygems.org' do | |
gem 'mechanize' | |
end |
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
# Convert XML to JSON | |
# | |
# Usage: | |
# x2j source_path [xsltjson parameters](https://github.com/bramstein/xsltjson#parameters) | |
# | |
# Reads from standard in if `source_path` set to `-`. | |
x2j() { | |
local base | |
base=src/github.com/bramstein/xsltjson |
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
lprompt() { | |
r=$? | |
[ $r -eq 0 ] && echo "?" || echo "!" | |
} |
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
# Composition | |
class Eat | |
def do_it | |
puts 'Nom, nom ...' | |
end | |
end | |
class Say | |
def do_it |
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
scala> def whatIsMyName[A,B](map: Map[A, Seq[B]]): List[(A, B)] = | |
| map.map { case (k, v) => v.map(k -> _) }.flatten.toList | |
whatIsMyName: [A, B](map: Map[A,Seq[B]])List[(A, B)] | |
scala> whatIsMyName(Map('a -> Seq(1,2), 'b -> Seq(3,4))) | |
res0: List[(Symbol, Int)] = List(('a,1), ('a,2), ('b,3), ('b,4)) |
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
# git lye | |
# An attempt to make rebasing easy, by draining unnessarcy commit noise. | |
# No warranty, use at own risk. | |
# Author Hannes Tydén <hannes@tyden.name> | |
# Contributor Tobias Schmidt <ts@soundcloud.com> | |
# TODO | |
# - Don't sign off all commits are by current user. |
NewerOlder