Skip to content

Instantly share code, notes, and snippets.

@x1a0
x1a0 / pre-push
Created February 11, 2014 10:33
Run test before pushing
#!/bin/bash
CMD="sbt test"
# Check if we actually have commits to push
commits=`git log @{u}..`
if [ -z "$commits" ]; then
exit 0
fi
@x1a0
x1a0 / sudo.zsh
Created February 18, 2014 16:04
zsh sudo
insert_sudo () { zle beginning-of-line; zle -U "sudo " }
zle -N insert-sudo insert_sudo
bindkey "^[s" insert-sudo
@x1a0
x1a0 / Cakefile
Created April 10, 2013 11:22
Cakefile for Sencha Touch development
{spawn} = require 'child_process'
dev = ->
cmd = "coffee"
args = ["-c", "-b", "-w", "-o", "app", "coffee"]
coffee = spawn cmd, args
coffee.stdout.pipe process.stdout
coffee.stderr.pipe process.stderr
coffee.on "exit", (status) ->
console.log "coffee exit with #{status}"
@x1a0
x1a0 / current_window_whois.pl
Created April 26, 2013 15:49
Irssi script: display /WHO and /WHOIS reply in current channel window.
sub level {
Irssi::window_find_name("(status)")->command("^window level $_[0]crap");
}
# https://www.alien.net.au/irc/irc2numerics.html
# /WHOIS
Irssi::signal_add_first("event 311", sub { level("-") } );
Irssi::signal_add_last("event 369", sub { level("+") } );
Irssi::signal_add_last("event 318", sub { level("+") } );
@x1a0
x1a0 / pre-commit.sh
Last active December 25, 2015 04:19
Git pre-commit script for checking debug codes
# If there are debug codes, print the offending file names and fail.
FILES_PATTERN='\.scala$'
FORBIDDEN='println'
git diff --cached --name-only | \
grep -E $FILES_PATTERN | \
GREP_COLOR='4;5;37;41' xargs grep --color --with-filename -n $FORBIDDEN && echo 'COMMIT REJECTED Found "$FORBIDDEN" references. Please remove them before commiting' && exit 1
@x1a0
x1a0 / map.tf
Created January 18, 2016 19:38 — forked from michael-donat/map.tf
; TEMP !!!!
/def -t'Nagle porywa cie nurt i niesie na wschod!' oxen_kanaly_event = \
/_map_go exit:e
;------------------------------------------------------------------------
; ... LISTY ... |
;------------------------------------------------------------------------
/set _map_standard_exits=\
n|polnoc|\
s|poludnie|\
var runFrom = function(step, lastStep, callback) {
var cb = step >= lastStep ? callback : function() {
runFrom(step + 1, lastStep, callback);
};
this['step' + step].call(this, cb);
};
runFrom(1, 17, function() {
console.log('finally done...');
});
@x1a0
x1a0 / zerofree.sh
Last active January 18, 2017 16:40
Zero out space on a virtual machine
init 1
for i in `mount | grep sda | grep ext | cut -b 9` ; do mount -o remount,ro /dev/sda$i && zerofree -v /dev/sda$i && mount -o remount,rw /dev/sda$i ; done ;
;; enhance entity name card
/def -F -p100 -mregexp -t'^\| A ([a-z]+) (fire|air|water|earth) entity ([a-z]+) with power .+ \|$' x_rw_entity_card_scan=\
/let size=0%;\
/let adjective=0%;\
/if ({P1} =~ 'titchy') /let size=$[size+1]%;\
/elseif ({P1} =~ 'miniscule') /let size=$[size+2]%;\
/elseif ({P1} =~ 'small') /let size=$[size+3]%;\
/elseif ({P1} =~ 'medium') /let size=$[size+4]%;\
/elseif ({P1} =~ 'large') /let size=$[size+5]%;\
/elseif ({P1} =~ 'huge') /let size=$[size+6]%;\
### Keybase proof
I hereby claim:
* I am x1a0 on github.
* I am x1a0 (https://keybase.io/x1a0) on keybase.
* I have a public key whose fingerprint is A1C5 7E23 F214 D0B0 23DD EE5C 7611 A0C8 01E2 2E78
To claim this, I am signing this object: