Skip to content

Instantly share code, notes, and snippets.

@washtubs
washtubs / gist:4148e1d2c18253608c36
Created July 9, 2014 00:01
get number of lines using wc
NR==1 {
( "cat " FILENAME " | wc -l" ) | getline NL
}
@washtubs
washtubs / Npass.awk
Created July 9, 2014 00:12
multi-pass
# Note! this only works if you pass the input as a file
# so that it can be read by wc.
BEGIN{pass=1; num_passes=4}
NR==1 {
( "cat " FILENAME " | wc -l" ) | getline NL
}
# ...enter custom code blocks here...
@washtubs
washtubs / record_proc.awk
Last active February 20, 2022 23:09
State machine
function get_state() {
return substr($0,1,1)
}
BEGIN {
#state machine spec
start_state="_BOF_"
state["_BOF_"]="H"
state["H"]="B"
state["B"]="D"
state["D"]="B|D|T"
@washtubs
washtubs / sample
Created July 20, 2014 07:23
Prolog if -> else
test(X,Y) :- % if -> else construct in prolog (converts atom 'True' to fact true)
( X = 'True' -> Y = true
; X = 'False' -> Y = false
).
% ?- test('True',Y), Y.
% Y = true.
%
% ?- test('False',Y), Y.
% false.
294,304c294
< # get the current version from .version.txt
< if [ -f "$origin_dir/.version.txt" ]; then
< current_version="$(cat "$origin_dir/.version.txt")"
< if [ -z "$current_version" ]; then
< echo "Something went wrong while getting the current version from '$origin_dir/.version.txt'"
< fi
< else
< current_version="?!?"
< echo "Unable to find file '$origin_dir/.version.txt' - Make sure it does exist."
apartments tips
http://www.reddit.com/r/LifeProTips/comments/2rwneo/lpt_request_when_apartment_searching_what_are/
older, but also good
http://www.reddit.com/r/LifeProTips/comments/19koc5/lpt_request_tips_for_a_first_apartment/

Falls at Sandy Springs, HUGE rooms, cheap
http://www.trulia.com/rental-community/9000055854/Falls-at-Sandy-Springs-5555-Roswell-Rd-Sandy-Springs-GA-30342/

Ashford Park, price upper, good reviews

http://www.trulia.com/rental-community/9000047331/Ashford-Park-2000-Asbury-Sq-Atlanta-GA-30346/

apartments tips
http://www.reddit.com/r/LifeProTips/comments/2rwneo/lpt_request_when_apartment_searching_what_are/
older, but also good
http://www.reddit.com/r/LifeProTips/comments/19koc5/lpt_request_tips_for_a_first_apartment/

Falls at Sandy Springs, HUGE rooms, cheap
http://www.trulia.com/rental-community/9000055854/Falls-at-Sandy-Springs-5555-Roswell-Rd-Sandy-Springs-GA-30342/

Ashford Park, price upper, good reviews

http://www.trulia.com/rental-community/9000047331/Ashford-Park-2000-Asbury-Sq-Atlanta-GA-30346/

#!/usr/bin/env zsh
if ! ( which ansi2html &>/dev/null ); then
echo You need to install ansi2html. This is just a convenient wrapper!
echo sudo cpan HTML::FromANSI
exit 1
fi
local space=""
@washtubs
washtubs / _qry
Last active September 9, 2018 16:29
find git grep combiner
#compdef qry
#autoload
function msg() {
echo $@ > /dev/pts/6
}
function _qry() {
find_part=()
grep_part=()
\ | / \ | / \ | /
/¯¯¯\ /¯¯¯\ /¯¯¯\
/¯\ | o o | /¯\ | o o | /¯\ | o o |
| | | 0 | | | | 0 | | | | 0 |
| |___|1 |______ | |___|2 |______ | |___|3 |______
\____ ____ \ \____ ____ \ \____ ____ \
| | | | | | | | | | | |
/¯¯¯¯ | \/ /¯¯¯¯ | \/ /¯¯¯¯ | \/
| |¯¯¯¯¯¯| | | |¯¯¯¯¯¯| | | |¯¯¯¯¯¯| |
| | | |____ | | | |____ | | | |____