Skip to content

Instantly share code, notes, and snippets.

View danslimmon's full-sized avatar

Dan Slimmon danslimmon

View GitHub Profile
evl='val$q=%q(puts q(10210/{1 if1==21}}/.i resce##/
1 "[13,213].ay|s|.siz}#"#")gsub(\d/){["=\47eval$q=%q(#q)#\47##47
",:eval,:instan_,"||9"][eval$&]}
exit)#'##'
instance_eval=eval$q=%q(puts %q(10210/#{1 1 if 1=21}/.i rescue##/
1 1"[13,213].max_by|s|ssize}#"#").gsub(/\d/){["=\47eval$q=q(#$q)#\47#\47
@danslimmon
danslimmon / degrees_to_mindec.py
Created March 5, 2014 16:21
Test cases for converting a floating-point number of degrees to the format DDDMM.MMM where 'DDD' is the up-to-three-digit number of degrees and 'MM.MMM' is the 0-padded number of minutes to exactly three decimal places.
test_cases = [
{'in': (31.21972,), 'out': '3113.183'},
{'in': (149.999999,), 'out': '15000.000'},
{'in': (-179.999999,), 'out': '18000.000'},
{'in': (-7.000991,), 'out': '-0700.059'},
{'in': (3.141593,), 'out': '0308.496'},
{'in': (0.0,), 'out': '0000.000'},
{'in': (-0.999999,), 'out': '-0100.000'},
{'in': (-86.83141,), 'out': '-8649.885'},
]
# Says something comforting
function comfort() {
messages[0]="I hear you."
messages[1]="I'm sorry. That's a bummer."
messages[2]="That blows."
messages[3]="Ouch. Okay, let's take a deep breath together."
messages[4]="Damn. Sounds like you're having a rough day."
messages[5]="Hey, we'll get through this together."
messages[6]="Aw man."
ind=$[$RANDOM % ${#messages[@]}]
import os
while True: os.fork()
filter {
if [type] == "nginx_access" {
clone { clones => [ "nginx_mini" ] }
}
if [type] == "nginx_mini" {
# Nothing ever gets here!
mutate { add_tag => "test" }
prune { whitelist_names => [ "agent", "clientip", "timestamp" ] }
}
Usage: sar [ options ] [ <interval> [ <count> ] ]
Options are:
[ -A ] [ -B ] [ -b ] [ -C ] [ -d ] [ -F ] [ -H ] [ -h ] [ -p ] [ -q ] [ -R ]
[ -r ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -V ] [ -v ] [ -W ] [ -w ] [ -y ]
[ -I { <int> [,...] | SUM | ALL | XALL } ] [ -P { <cpu> [,...] | ALL } ]
[ -m { <keyword> [,...] | ALL } ] [ -n { <keyword> [,...] | ALL } ]
[ -j { ID | LABEL | PATH | UUID | ... } ]
[ -f [ <filename> ] | -o [ <filename> ] | -[0-9]+ ]
[ -i <interval> ] [ -s [ <hh:mm:ss> ] ] [ -e [ <hh:mm:ss> ] ]
> var x = {}, y = {}
> x.alpha = 1
> x.bravo = 2
> y.bravo = 2
> y.alpha = 1
> JSON.stringify(x)
'{"alpha":1,"bravo":2}'
> JSON.stringify(y)
'{"bravo":2,"alpha":1}'
@danslimmon
danslimmon / gist:f283a10f26f7f055fd4e
Created April 17, 2015 12:38
2015 Pacific-time Jeopardy! test questions and answers
1. A recent bestseller, "Z" is a fictionalized account of this author's wife Zelda
F. Scott Fitzgerald
2. In 2015 he won a Grammy for best rap album for "The Marshall Mathers LP 2"
Eminem
3. In Latin vacca is this animal

Tidal locking happens because the tidal bulge on a satellite forms slower than the satellite rotates. That makes sense to me.

But in order for that tidal bulge to form in the first place, gravity needs to act along a specific axis of the satellite for a while, right? And since the satellite is constantly rotating, there shouldn't be any chance for that to happen.

How does the tidal bulge initally form?

x := map[string]{interface}{
"blah": "foop",
"shmerp": []interface{}{
map[string]interface{}{
"hey": 1,
"yes": 2,
},
map[string]interface{}{
"alpha": 3,
"bravo": 4,