Skip to content

Instantly share code, notes, and snippets.

@hagmonk
hagmonk / Do they really care?
Created December 31, 2008 07:50
A dumb little script to analyze your twitter followers.
#!/usr/bin/ruby
require 'rubygems'
require 'net/http'
require 'hpricot'
class Twitter
def initialize(username, password)
#!/usr/bin/env arch -i386 ruby
# TextMate's default insert color command is pretty lame. I wanted it to detect
# rgb values and use those, outputting the same if detected. Here's my first naive
# cut at improving this script. I think it should fall through a few different
# filters, trying to detect whether it's hex, rgb, or a color name (who uses those?!)
require ENV['TM_SUPPORT_PATH'] + "/lib/ui"
require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes"
colour = STDIN.read
#!/bin/bash
# Quite often I buy some music at home, then want to transfer it to work.
# This command is what I use to find m4a tracks created in the last day,
# and pull them to my work machine.
ssh username@domain "cd /Volumes/Media/iTunes && find . -mtime -1 -name "*.m4a" | tar -T - -cf -" | tar xf -
ANZAC biscuits
Ingredients:
* 1 cup whole wheat flour
* 1 cup sugar
* 1 cup desiccated coconut
* 1 cup rolled oats
* 1/2 cup butter (i.e. one whole stick of butter)
* 2 tbs honey or golden syrup
#!/usr/bin/ruby
require 'rubygems'
require 'net/ssh'
require 'net/scp'
thingsPath = "HOME/Library/Application\ Support/Cultured\ Code/Things/Database.xml"
getTimestamp = "ls -lT '#{thingsPath}' | cut -f9-13 -d' '"
getThings = "ps waux | grep [T]hings"
quitThings = "osascript -e 'tell application \"Things\"\nquit\nend tell'"
@hagmonk
hagmonk / gist:241a8083c5d764708010
Last active August 29, 2015 14:19
Cheryl's birthday
(*
Procedural answer to the question posted here:
"http://nbviewer.ipython.org/url/norvig.com/ipython/Cheryl.ipynb"
Doing this in other fun mathematica ways is left as an exercise for the reader :)
*)
In[665]:= str = " May 15 May 16 May 19
June 17 June 18
July 14 July 16
@hagmonk
hagmonk / calendar.ics
Created November 29, 2016 21:30
Clojure/conj 2016 Calendar
BEGIN:VCALENDAR
METHOD:PUBLISH
VERSION:2.0
X-WR-CALNAME:Clojure/conj 2016
PRODID:-//Apple Inc.//Mac OS X 10.12.2//EN
X-APPLE-CALENDAR-COLOR:#1BADF8
X-WR-TIMEZONE:America/Los_Angeles
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:America/Chicago
@hagmonk
hagmonk / community.md
Last active November 11, 2018 05:38
Clojure Community Collaboration Tools

This document lists ...

  • High level requirements for a community collaboration tool, ranked by importance to the Clojure community.
    • mandatory
    • expected
    • nice to have
  • Extant collaboration tools, with pointers towards existing Clojure communities within them, if any.
  • A detailed analysis of how each tool satisfies the requirements of the Clojure community.
@hagmonk
hagmonk / result-set-test.clj
Last active June 17, 2017 01:01
the not-very-lazy ResultSet
(ns result-set-test.core
(:require [clojure.java.jdbc :as jdbc]
[clojure.string :as str])
(:gen-class)
(:import (java.sql ResultSet)
(clojure.lang IReduceInit)))
(def sqlvec ["select left(md5(i::text), 10),
md5(random()::text),
md5(random()::text),
@hagmonk
hagmonk / conj2017.ics
Last active October 12, 2017 19:00
Clojure/conj 2017 calendar
BEGIN:VCALENDAR
METHOD:PUBLISH
VERSION:2.0
X-WR-CALNAME:Clojure/conj 2017
PRODID:-//Apple Inc.//Mac OS X 10.13//EN
X-APPLE-CALENDAR-COLOR:#CC73E1
X-WR-TIMEZONE:America/Los_Angeles
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:America/New_York