Skip to content

Instantly share code, notes, and snippets.

@hmarr
hmarr / pg_read_only_config.md
Created October 29, 2015 12:02
Safely updating standard_conforming_strings - pg8.1 vs pg8.2

Postgres 8.1

$ ./bin/psql template1
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
@hmarr
hmarr / md
Last active December 16, 2015 15:09
Accept Github flavoured markdown on stdin, and render it in the browser
#!/usr/bin/env python
import sys
import urllib2
import json
import webbrowser
import BaseHTTPServer
import threading
markdown = sys.stdin.read()
@hmarr
hmarr / tcping
Last active November 6, 2019 14:04
TCP ping in Ruby
#!/usr/bin/env ruby
require "socket"
require "timeout"
if ARGV.length < 2
puts "usage: tcping HOST PORT"
exit 1
end
@hmarr
hmarr / color-calendar-events.gs
Last active November 8, 2023 23:10
Google Apps Script to automatically color calendar events
// Setup instructions
//
// Copy and paste into a Google Apps Script project. Feel free to change the colors below.
//
// Add a trigger to run the colorUpdatedCalendarEvents function the on the "Calendar updated" event of
// your calendar.
const PERSONAL_COLOR = CalendarApp.EventColor.GRAY;
const IN_PERSON_COLOR = CalendarApp.EventColor.BLUE;
const EXTERNAL_COLOR = CalendarApp.EventColor.RED;
// Setup instructions
//
// Copy and paste into a Google Apps Script project. Make sure you set the source calendar id constant
// below. It should be set to the email address of the source calendar.
//
// Add a trigger to run the syncUpdatedEventsIncremental function the on the "Calendar - Changed" event
// of the source calendar.
//
// The first time you run this, you might want to select the "resyncEvents" function, and manually run
// it in the Apps Script editor.