Skip to content

Instantly share code, notes, and snippets.

View sitharus's full-sized avatar

Thea Hutchings sitharus

View GitHub Profile
@sitharus
sitharus / gist:2887417
Created June 7, 2012 08:30
Query Plans
=# explain update messages set notified = false where NOT EXISTS(SELECT * FROM users u INNER JOIN devices d ON u.id = d.user_id WHERE u.id = messages.user_id);
QUERY PLAN
-------------------------------------------------------------------------------------
Hash Anti Join (cost=305.05..9400.07 rows=1 width=219)
Hash Cond: (messages.user_id = u.id)
-> Seq Scan on messages (cost=0.00..8219.35 rows=175135 width=219)
-> Hash (cost=279.28..279.28 rows=2061 width=4)
-> Hash Join (cost=86.37..279.28 rows=2061 width=4)
Hash Cond: (u.id = d.user_id)
-> Seq Scan on users u (cost=0.00..156.20 rows=3220 width=4)
@sitharus
sitharus / homebrew.patch
Created February 24, 2013 07:21
Patch to make GtkEveMon build under homebrew
--- Makefile 2013-02-24 20:18:50.000000000 +1300
+++ Makefile 2013-02-24 20:19:04.000000000 +1300
@@ -1,5 +1,3 @@
-INSTALL_BIN = /usr/local/bin
-
all:
$(MAKE) -C src
@@ -12,9 +10,7 @@
install:
@sitharus
sitharus / convert.py
Created July 26, 2017 07:28
Convert static site to markdown/hugo
import os
import re
import sys
from bs4 import BeautifulSoup
import html2text
def generate_frontmatter(title, date):
return """---
title: %s
date: %s
open System
type direction = Up of int | Down of int | Left of int | Right of int
let parseMove (move:string) =
let value = int <| move.Substring(1)
match move.Substring(0, 1) with
| "U" -> Up value
| "D" -> Down value
| "L" -> Left value