Skip to content

Instantly share code, notes, and snippets.

View marcransome's full-sized avatar

Marc Ransome marcransome

View GitHub Profile
@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"?
@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: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 / 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 / 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 / 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 / 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 / pack
Last active October 29, 2015 19:42
Box packing script for Vagrant VMWare plugin.
#!/bin/bash
#
# Copyright (c) 2015 Marc Ransome <marc.ransome@fidgetbox.co.uk>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
set DESIRED_JDK "1.8"
if set JDK (/usr/libexec/java_home -F -v $DESIRED_JDK ^ /dev/null)
set -x JAVA_HOME $JDK
else
echo "Desired JDK version not found ($DESIRED_JDK)"
end

Keybase proof

I hereby claim:

  • I am marcransome on github.
  • I am marcransome (https://keybase.io/marcransome) on keybase.
  • I have a public key ASBZWoIk_280bRa6txmK8vHF-LY5gdvGG24M18V52d7qQAo

To claim this, I am signing this object: