Skip to content

Instantly share code, notes, and snippets.

@growse
growse / gist:1306667
Created October 23, 2011 00:13
SQLite schema updater
/*
I needed a way to look at an existing SQLite schema, compare it to a text file containing some table
definitions and then work out if the two were the same. Here's how I did it.
The hashtable 'givenschema' contains each table create statement keyed by the name of the table.
*/
public static void CheckSchema()
{
@growse
growse / Program.cs
Created November 10, 2011 14:50
Bulk copy SQL from GNU splitted Postgres CSV output into MSSQL with IDENTITY_INSERT
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
namespace ARGHGHGHGHG
{
internal class Program
{
static int progress = 0;
@growse
growse / uploadmaildir.pl
Created June 25, 2012 22:30
A way to incrementally upload a maildir to gmail's IMAP servers. Originally by Andreas Kammlott, with some changes
#!/usr/bin/perl
# by Andreas Kammlott, thanks to perl and its community
use IO::Socket::SSL;
use Data::Dumper;
use HTTP::Date qw(str2time);
use HTTP::Date qw(parse_date);
use Date::Format;
use Mail::IMAPClient;
use Mail::Box::Maildir;
@growse
growse / iostat_to_graphite.py
Created July 19, 2012 08:07
Python port of a https://gist.github.com/915862 to send disk stats in solaris to a remote graphite server.
#!/usr/bin/python
"""
Run this with something like iostat -nx 60 2 | iostat_to_graphite.py
"""
import sys, os, re, socket, time
"""ARGF from Ruby in Python.
Released into the public domain by Andrew Gwozdziewycz, 2010
"""
@growse
growse / kstat_to_graphite.py
Created July 24, 2012 10:03
Parse kstat -p output and fling it at graphite.
#!/usr/bin/python
import sys, os, re, socket, time
"""ARGF from Ruby in Python.
Released into the public domain by Andrew Gwozdziewycz, 2010
"""
class _ARGF(object):
def __init__(self):
@growse
growse / unbound_to_graphite.sh
Created July 31, 2012 19:37
Output unbound statistics for sending to graphite
#!/bin/bash
/usr/sbin/unbound-control stats|grep -E '^total\.|^num\.' | sed 's/=/\t/' | gawk 'BEGIN{"hostname -f" | getline hstnm ; }; {print "unbound." hstnm "." $0"\t" strftime("%s")}'
@growse
growse / gist:4745746
Created February 9, 2013 15:37
Teamcity powershell task to output current build number, date, and svn rev in JSON to 'build.json' in root.
Add-Type -Assembly System.ServiceModel.Web,System.Runtime.Serialization
function Read-Stream {
PARAM(
[Parameter(Position=0,ValueFromPipeline=$true)]$Stream
)
process {
$bytes = $Stream.ToArray()
[System.Text.Encoding]::UTF8.GetString($bytes,0,$bytes.Length)
}}
@growse
growse / fontswitcher.js
Last active February 14, 2020 23:17
Bookmarklet that lets you apply arbitrary google fonts to jQuery selectors.
var bkmkltFontChooser = function () {
return {
v: "1.10.2",
jQueryDone: false,
webfontDone: false,
fontChooserLoaded: false,
loadjQuery: function () {
if (window.jQuery === undefined || window.jQuery.fn.jquery < bkmkltFontChooser.v) {
console.log("Loading jQuery");
var script = document.createElement("script");
Exception in thread "main" java.lang.RuntimeException: No such var: leiningen.util.injected/add-hook, compiling:(NO_SOURCE_PATH:1:3757)
at clojure.lang.Compiler.analyze(Compiler.java:6380)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3573)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6562)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
@growse
growse / measureping.py
Created May 7, 2014 21:47
Script to measure gateway ping and wifi strength/bitrate and pipe into graphite.
#!/usr/bin/env python
import argh
import sh
import subprocess
import ping
import socket
import time
import sys
import re