Skip to content

Instantly share code, notes, and snippets.

View marcransome's full-sized avatar

Marc Ransome marcransome

View GitHub Profile
@marcransome
marcransome / dnsimple.sh
Last active January 2, 2016 16:49
DNSimple.com domain ALIAS update script
#!/usr/bin/env bash
EMAIL=""
API_TOKEN=""
DOMAIN_ID=""
RECORD_ID=""
EXTERNAL_IP="`curl http://rqst.io/ip | jgrep -s "ip"`"
curl -H "Accept: application/json" \
-H "Content-Type: application/json" \
@marcransome
marcransome / jp.fish
Last active December 20, 2015 07:49
A fish shell function that opens the default editor with a date prepended filename and the specified title for jekyll posts.
function jp -d "Open default editor with date prepended filename and specified title for jekyll posts."
set title (date +"%Y-%m-%d")
switch (count $argv)
case 0
echo "No post title was specified."
return 1
case 1
set lower_arg (echo $argv[1] | tr A-Z a-z)
@marcransome
marcransome / stathat.rb
Created May 18, 2013 17:14
A simple ruby script for logging Raspberry Pi temperature, CPU usage and voltage to StatHat.
#!/usr/bin/env ruby
require 'rubygems'
require 'stathat'
api_key = ""
# strip any leading text up to and including the equals symbol,
# and strip the specified number of trailing characters
def stripcruft(string, trailingchars)
@marcransome
marcransome / PathView.qml
Created February 18, 2013 20:08
Rapid mouse scrolling can cause invisible delegates.
import QtQuick 2.0
Rectangle {
id: scene
width: 1280
height: 800
color: "white"
PathView {
anchors.fill: parent
@marcransome
marcransome / gist:3154136
Created July 21, 2012 01:17
Installing tmux on Amazon EC2
sudo yum install libevent-devel
wget http://downloads.sourceforge.net/tmux/tmux-1.6.tar.gz
tar -xvzf tmux-1.6.tar.gz
cd tmux-1.6
./configure
make
sudo make install
@marcransome
marcransome / example.m
Created May 24, 2012 20:30
Highlight filename excluding extension in save panel
NSSavePanel *savePanel = [NSSavePanel savePanel];
[savePanel setPrompt:@"Save"];
[savePanel setNameFieldStringValue:@"Test.txt"];
[savePanel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger returnCode)
{
if (returnCode == NSOKButton)
{
// respond to button click
}
@marcransome
marcransome / gist:2774268
Created May 23, 2012 09:37
macdeployqt fails under Mac OS X 10.4.7 with Qt 4.8.2
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?