Skip to content

Instantly share code, notes, and snippets.

@xdbr
xdbr / gist:64dda273e7490d142acc
Created September 6, 2015 15:28
how many coins to i need?
perl -E'!+0,$ ,=$",$:+=+shift,=>map{$:-=$_=>push@,=>$_>=!$!?~~qq,$_€,:($_*100.).q.¢.while$:-$_>=$!}2,1,.5,.2,.1,.05,.01;say+0||@,' 1.23
@xdbr
xdbr / a.rb
Created September 5, 2015 13:15
coins
perl -E '$:+=+shift;do{$:-=$_,$@++while$:-$_>=0;say"$@x",$_>=1?"$_€":($_*100,"¢"),if$@;$@=0}for+2,1,.5,.2,.1,.05,.01' 15.43
@xdbr
xdbr / a.rb
Created August 27, 2015 10:34
execution order?
find $(pwd ; echo $(ls)) -name $(echo "*.bar") -maxdepth 1
@xdbr
xdbr / foo.perl
Created August 19, 2015 19:03
Build GNU make dependency graph using dot
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
@ARGV or die "Usage:\n\tperl $0 Makefile\nthen:\n\t | dot -Tpng -oout.png\n";
my $dotopts = q{
# rankdir=LR
# node [shape=record,width=.1,height=.1]
@xdbr
xdbr / a.rb
Created August 19, 2015 18:39
find stale, leftover branches in git (add to ~/.gitconfig)
stale = "! abandoned_branches() { \
for branch in `git branch -r --no-merged | grep -v HEAD`; do \
echo `git show --format='%ci %cr %ae' $branch | head -n 1` $branch; \
done | sort -r | column -t; \
}; abandoned_branches"
@xdbr
xdbr / a.rb
Created August 19, 2015 18:38
JAPH
perl -E '%~=@~=(-japh,japh,j,just,a,another,p,perl,h,hacker),( $_ = @~[ ~-@~ ] )~~( y-hacker-japh-s,s - *(~|j|~|a|~|p|~|h|~) *- ~~ "$~{$+} " -goppie,-say,)'
@xdbr
xdbr / a.rb
Last active August 29, 2015 14:27
osx: join network from commandline // network should not include spaces // needs "fzf" and "pass" installed
network=$(airport -s | fzf | cut -b 1-33 | sed -e 's/^ *//' -e 's/ *$//') && networksetup -setairportnetwork en0 $network $(pass wifi/$network)