Skip to content

Instantly share code, notes, and snippets.

View unfo's full-sized avatar

Jan Wikholm unfo

View GitHub Profile
#!/bin/bash
ls -f1 | grep -Po '.*(?=20[0-1][0-9][-_]?[0-2][0-9][-_]?[0-3][0-9])' | awk '{ print $NF }' | sort | uniq | egrep -v '[0-9]'
#!/bin/ruby
require 'date'
THRESHOLD = ARGV[0].to_i || 10 # seconds
prev_line = ''
prev_dtm = nil
prev_line_printed = false
def seconds_between(dtm1, dtm2)

Keybase proof

I hereby claim:

  • I am unfo on github.
  • I am unfo (https://keybase.io/unfo) on keybase.
  • I have a public key whose fingerprint is 1485 CCD5 91B1 AFDE 6600 6470 9989 5A38 C6F4 E0DE

To claim this, I am signing this object:

#!/bin/bash
#
# Author: @unfo
#
# Prints files for a given relative day
#
# 0 = today # this is also the default
# -1 = yesterday
# -2 = day before yesterday
@unfo
unfo / keybase-login-problem
Created September 17, 2014 12:18
keybase login -- Segmentation fault: 11
rlyeh:t2 jw$ keybase login
warn: No config file found; tried '/Users/jw/.config/keybase/config.json'
Your keybase username or email: unfo
Your keybase login passphrase: ..
Segmentation fault: 11
rlyeh:t2 jw$ keybase version
warn: No config file found; tried '/Users/jw/.config/keybase/config.json'
keybase (keybase.io CLI) v0.6.0
- node.js v0.10.31
- gpg (GnuPG/MacGPG2) 2.0.22
awk '/(18|19|2.)\/Sep/ {
ts=substr($4,2,14);
if (ts != prevts) {
printf("\n%s ", ts);
prevts=ts;
};
if ($9 == 200) { printf("."); }
else if ($9 == 500) { printf("!"); }
else if ($9 == 404) { printf("?"); }
else if (substr($9,1,1) == "3") { printf(">"); }
@unfo
unfo / output
Created September 29, 2014 11:23
TIL about Bash exec
rlyeh:work jw$ bash testredir.sh
rlyeh:work jw$ cat logfile
foo
bar
-- USE: lua markov.lua pre-populated-history.log new-input-without-nicknames.log > ~/irc/NETWORK/#channel/in
local brain = {}
local NOWORD = "\0"
local history = arg[1]
local present = arg[2]
--[[
x: (where x is not one of the magic characters ^$()%.[]*+-?) represents the character x itself.
.: (a dot) represents all characters.
%a: represents all letters.
@unfo
unfo / lib.rs
Created December 21, 2014 18:37
Compiling fastgraph v0.0.1 (file:///Users/jw/fun/rust/fastgraph)
/Users/jw/fun/rust/fastgraph/src/lib.rs:18:4: 24:5 error: match arms have incompatible types: expected `()`, found `core::option::Option<<generic #127>>` (expected (), found enum core::option::Option)
/Users/jw/fun/rust/fastgraph/src/lib.rs:18 match re.find(line) {
/Users/jw/fun/rust/fastgraph/src/lib.rs:19 Some((from,end)) => {
/Users/jw/fun/rust/fastgraph/src/lib.rs:20 let i: int = from_str(line.slice(from,end)).unwrap();
/Users/jw/fun/rust/fastgraph/src/lib.rs:21 Some(i);
/Users/jw/fun/rust/fastgraph/src/lib.rs:22 },
/Users/jw/fun/rust/fastgraph/src/lib.rs:23 _ => None
...
/Users/jw/fun/rust/fastgraph/src/lib.rs:23:10: 23:14 note: match arm with an incompatible type
pub struct Vertice {
pub source: int,
pub target: int,
pub weight: int,
}
pub struct Node {
pub id: int,
pub vertices: Vec<Vertice>,
}