I hereby claim:
- I am bgreenlee on github.
- I am bgreenlee (https://keybase.io/bgreenlee) on keybase.
- I have a public key whose fingerprint is C683 EE62 E928 D6F9 EEB7 9EB3 5545 85A5 A54D 1F04
To claim this, I am signing this object:
HOOK_URL=https://hooks.slack.com/services/.../.../... | |
curl -X POST --data-urlencode "payload={\"channel\": \"#random\", \"username\": \"randombot\", \"text\": \"$(curl -s 'http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC' | sed -nE 's/^.*image_original_url":"([^"]+)".*$/\1/gp' | sed 's/\\//g')\", \"icon_emoji\": \":$(curl -s http://www.emoji-cheat-sheet.com/ | sed -n -E 's/^.*<span class="name".*>(.*)<\/span>.*$/\1/gp' | perl -MList::Util -e 'print List::Util::shuffle <>' | head -1):\"}" $HOOK_URL |
func flashScreen() { | |
let inDuration: CGDisplayFadeInterval = 0.5 | |
let outDuration: CGDisplayFadeInterval = 0.5 | |
let color = NSColor.redColor() | |
var fadeToken: CGDisplayFadeReservationToken = 0 | |
let colorToUse = color.colorUsingColorSpaceName(NSCalibratedRGBColorSpace)! | |
let err = CGAcquireDisplayFadeReservation(inDuration + outDuration, &fadeToken) | |
if Int(err) != Int(kCGErrorSuccess.value) { | |
NSLog("Error acquiring fade reservation") |
package main | |
/** | |
* Bare-bones slash command handler for Slack | |
* | |
* Commands: | |
* /weather [city] - Return the current weather for the given city | |
*/ | |
import ( |
/** | |
* Levenshtein edit distance calculator | |
* Usage: levenstein <string> <string> | |
* | |
* To compile: | |
* sudo xcode-select -switch /Applications/Xcode6-Beta.app/Contents/Developer | |
* xcrun swift -sdk $(xcrun --show-sdk-path --sdk macosx) levenshtein.swift | |
*/ | |
import Foundation |
#!/usr/bin/env python | |
# Convert a location name to tab-separated place name, lat, lon, and time zone. | |
# Adapted from http://blog.pamelafox.org/2012/04/converting-addresses-to-timezones-in.html | |
# | |
# Installation: | |
# 1. Get a free Geonames account: http://www.geonames.org/login | |
# Note: after you confirm your account, you'll need to enable it to use the | |
# free web service at http://www.geonames.org/manageaccount | |
# 2. Install/download geopy and geonames libraries: |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env ruby | |
# Boggle(tm) puzzle solver | |
# by Brad Greenlee <brad@footle.org> | |
# (Boggle is a trademark of Hasbro Inc., who has no affiliation with this | |
# program and hopefully couldn't care less about its existence.) | |
BOARD_SIZE = 4 | |
MAX_WORD_SIZE = 12 | |
MIN_WORD_SIZE = 3 |
INSERT INTO 'snippets' ('title', 'body') VALUES | |
(':+1:', '👍'), | |
(':-1:', '👎'), | |
(':100:', '💯'), | |
(':1234:', '🔢'), | |
(':8ball:', '🎱'), | |
(':a:', '🅰'), | |
(':ab:', '🆎'), | |
(':abc:', '🔤'), | |
(':abcd:', '🔡'), |
val ranges = List((2,3), (1,2), (5,11), (4,10), (3,3), (6,7), (15,16)) | |
ranges.sorted.foldLeft(List[(Int, Int)]()) { (acc, t) => | |
acc match { | |
case x :: xs if x._2 >= t._1 => (x._1, math.max(x._2, t._2)) :: xs | |
case x :: xs => t +: acc | |
case _ => List(t) | |
} | |
}.reverse |
# logtail from logcheck (http://logcheck.org/) | |
*/15 * * * * /usr/sbin/logtail /path/to/some/log/file.log | egrep "WARN|ERROR|Exception" | head |