Skip to content

Instantly share code, notes, and snippets.

View danhigham's full-sized avatar

Dan Higham danhigham

View GitHub Profile
@danhigham
danhigham / dvdrip.bash
Last active December 31, 2015 03:09
Bash script to sit in a loop and continuously rip vobs from a DVD. When it's done a disk it sends a notification email, ejects the draw and waits for another disc.
#!/usr/bin/env bash
SUBJECT="DVD is done ripping"
EMAIL="email@gmail.com"
EMAILMESSAGE="./emailmessage.txt"
while [ 1 ]
do
echo "Waiting for new disk.."
@danhigham
danhigham / Gemfile
Last active December 29, 2015 18:09
Download a mixcloud stream!
source 'http://rubygems.org'
gem 'httparty'
gem 'nokogiri'
@danhigham
danhigham / remote_shell_agent.rake
Last active December 29, 2015 02:49
Rake task to communicate with a faye server and provide connectivity to it's application container
namespace :remote_shell_agent do
module Faye
class Transport::Http < Transport
def request(envelopes)
content = encode(envelopes)
params = build_params(@endpoint, content)
request = create_request(params)
@danhigham
danhigham / app.js
Created November 22, 2013 16:13
Faye server in a Gist!
var http = require('http'),
faye = require('faye');
var server = http.createServer(),
bayeux = new faye.NodeAdapter({mount: '/'});
bayeux.attach(server);
server.listen(process.env.PORT);
@danhigham
danhigham / Gemfile
Last active December 13, 2015 16:49
Simple session persistence with Redis and Sinatra
source :rubygems
gem 'sinatra'
gem 'redis'
gem 'httparty'
@danhigham
danhigham / dump_controller.rb
Created February 6, 2013 15:49
Dump Controller
require 'cfoundry'
require 'tempfile'
require 'zip/zip'
require 'tunnel-vmc-plugin/tunnel'
CF_ENDPOINT = 'http://api.cloudfoundry.com'
class DumpController < ApplicationController
def new
@danhigham
danhigham / Gemfile
Last active October 27, 2018 15:44
Simple ruby script to download the contents of an application running on Cloud Foundry to a zip file
source :rubygems
gem 'cfoundry'
gem 'uuidtools'
@danhigham
danhigham / Markdown-Terminal.sublime-snippet
Created January 29, 2013 12:13
Sublime snippet to create terminal blocks in markdown
<snippet>
<content><![CDATA[
<pre class="terminal">
$1
</pre>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>term</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.markdown</scope> -->
@danhigham
danhigham / gist:4654412
Created January 28, 2013 10:15
Sample manifest.yml for node app with env variable
---
applications:
- name: nodetestdh01
framework: node
runtime: node08
memory: 64M
instances: 1
url: nodetestdh01.${target-base}
path: .
env:
@danhigham
danhigham / node-pg-example.js
Created November 5, 2012 16:28
Node PG example
/*
* GET home page.
*/
var pg = require('pg');
exports.index = function(req, res){
var conString = "tcp://127.0.0.1/postgres";
var out = "";