Skip to content

Instantly share code, notes, and snippets.

View murphybytes's full-sized avatar

John Murphy murphybytes

View GitHub Profile
export PATH=/Applications/Postgres93.app/Contents/MacOS/bin:$PATH
@murphybytes
murphybytes / gist:5490197
Created April 30, 2013 17:11
Typical chef client configuration
log_level :info
log_location STDOUT
node_name 'east-prod-jumpserver'
@murphybytes
murphybytes / remove.c
Last active December 15, 2015 01:59
My implementation of an O(n) algorithm that removes characters from a string.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main( int argc, char* argv[] ) {
if( argc < 3 ) {
printf( "Usage: repl <word> <char to replace>\n" );
return 1;
@murphybytes
murphybytes / motion_sensor.ino
Created December 22, 2012 17:46
This Arduino sketch is used to interact with a motion sensor.
int led_pin = 13;
int pir_pin = 2;
int pir_state = LOW;
int pin_status = 0;
void setup() {
pinMode( led_pin, OUTPUT );
pinMode( pir_pin, INPUT );
Serial.begin(9600);
@murphybytes
murphybytes / thewayitisnow.rb
Created November 29, 2012 19:41
before and after
{ renditions: [
remoteUrl: get_encoded_asset_url( 'LOW' ),
type: 'VIDEO_FULL',
displayName: "#{get_file_basename}_LOW",
refid: "#{get_file_basename}_LOW",
videoDuration: -1,
size: 0,
encodingRate: 563000,
frameWidth: 640,
frameHeight: 360,
@murphybytes
murphybytes / diskcheck.sh
Created October 1, 2012 12:18
does remote disk checks
#!/bin/bash
limit=$2
echo $1
number=`ssh jam@${1} df -lah | awk '$1=="/dev/sda5"{print int($5)}'`
echo $number
@murphybytes
murphybytes / ksp.json
Created August 9, 2012 14:55
kbitz collaboration setup message
{
"message_type" : "collaboration",
"collaboration_id" : "7483cac0-e22f-11e1-9b23-0800200c9a66",
"type" : "setup",
"version" : 0.1,
"task" : [{
"worker_id" : "0b152bf0-e230-11e1-9b23-0800200c9a66",
"worker_type" : "spatial",
"task" : [ {
"worker_id" : "1b152bf0-e230-11e1-9b23-0800200c9a66",
@murphybytes
murphybytes / Program.cs
Created July 25, 2012 03:37
Demonstrates using pinvoke to pass a callback from a .net managed application to a C dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace MyCSharpApp
{
@murphybytes
murphybytes / dummy.sh
Created June 11, 2012 18:05
create a dummy account for Mac OSX
cp $HOME/.bash_profile $HOME/bash_profile.$(date +%Y%m%d.%s).backup
grep -q DUMMY_ACCOUNT= $HOME/.bash_profile || echo "export DUMMY_ACCOUNT=${DUMMY_ACCOUNT}" >> $HOME/.bash_profile
last_uid=$(dscl . -list /Users UniqueID | awk '$2 > 500 { print $2 }' | sort -ug | tail -n1)
unique_uid=`expr $last_uid + 1`
echo "Creating user $DUMMY_ACCOUNT with UID $unique_uid"
dscl . -create /Users/$DUMMY_ACCOUNT
dscl . -create /Users/$DUMMY_ACCOUNT UserShell /bin/bash
dscl . -create /Users/$DUMMY_ACCOUNT RealName 'dummy account'
@murphybytes
murphybytes / shared_ptr.hpp
Created June 6, 2012 03:14
Had to roll my own shared pointer
#ifndef __SHARED_PTR_HPP__
#define __SHARED_PTR_HPP__
#include <string>
#include <sstream>
using std::string;
using std::stringstream;
namespace ucp {