Skip to content

Instantly share code, notes, and snippets.

View JamesHarrison's full-sized avatar

James Harrison JamesHarrison

View GitHub Profile
# Edit this file by (un)commenting the libraries that you (don't) want to
# build in order to get the corresponding features in liquidsoap.
# The default file has every dependency enabled.
# It is certain that you don't need everything.
# If you don't know why you should have something, uncomment it,
# especially if it does not build for some reason.
# It is useless to add savonet packages that are not listed below,
# like ocaml-fetch, ocaml-smbclient, etc. These are not dependencies of
@JamesHarrison
JamesHarrison / Studio_Arduino.pde
Created April 24, 2011 19:39
The code for the matrix display in the Insanity Radio studio. Also does non-clock functions like read an LM35DT.
/*
Credit where it's due: Contributors to
* https://github.com/londonhackspace/MatrixDisplay
* https://github.com/londonhackspace/NotifyBoard
and the authors of the Time, TimeAlarms and TimedAction libraries.
Loads of this code is sort of cobbled together but it works. Assumes 4 SURE Electronics 32x8 display boards.
Confines the clock to +-16 from each end, and uses the ends for flags, which can be enabled/disabled with ~1\n or ~0\n to the serial interface; clock is set with #unixtimestamp over serial, in response to a ascii bell character being received by the controller. Arbitrary text and a \n is written to the display and shown for 10 seconds from the last bit of text being sent.
*/
@JamesHarrison
JamesHarrison / cortex.textile
Created April 23, 2011 15:20
First cortex spec. Ish.

Cortex AMQP/Component Specification

This document aims to identify the various things clients need to be able to do and report back to a master, and what a master needs to be able to be told in terms of AMQP messages and queues as well as basic functions of the components.

We divide the list of tasks up by client and master; masters will also run a local client daemon. Masters are all about command and control, with clients just doing what the heck the master tells them to do.

JACK Automation

Master

require 'RMagick'
include Magick
img = ImageList.new("noise16.PNG")
data = []
y = 2
x = 0
while (y <= 398) do
while (x <= 398) do
puts "y = #{y}, x = #{x}"
data << img.pixel_color(x,y).intensity
require 'open-uri'
require 'rubygems'
require 'data_mapper'
puts "Starting DB connect"
DataMapper.setup(:default, 'postgres://test@localhost/test')
puts "Connected"
class Point
include DataMapper::Resource
property :id, Serial
property :remaining, Integer
james@perfidy:~$ cdparanoia -h
cdparanoia III release 10.2 (September 11, 2008)
(C) 2008 Monty <monty@xiph.org> and Xiph.Org
Report bugs to paranoia@xiph.org
http://www.xiph.org/paranoia/
USAGE:
cdparanoia [options] <span> [outfile]
@JamesHarrison
JamesHarrison / check_redis
Created March 14, 2011 03:38
silenthack.sh
#!/usr/bin/env python
import sys,argparse,redis
nagios_codes = {'OK': 0,
'WARNING': 1,
'CRITICAL': 2,
'UNKNOWN': 3,
'DEPENDENT': 4}
def nagios_return(code, response):
@JamesHarrison
JamesHarrison / config.ru
Created January 7, 2011 06:56
A lightweight Sinatra app to act as a HTTP gateway between P Squared Myriad 3.5 and the outside world
require "rubygems"
require "sinatra"
require './myriadproxy'
run MyriadProxy
@JamesHarrison
JamesHarrison / dropboxes.rb
Created November 13, 2010 13:13
Dropbox script for Myriad 3.5+
# Dropbox import script
require 'find'
require 'socket'
# This _so_ needs more functions and any sort of error handling whatsoever.
class MyriadInterface
def initialize
@socket = TCPSocket.new( 'localhost', 6950 )
end
def import(path,start,finish)
puts "Importing file '#{path}' to cart range between #{start} and #{finish}"
# A small script to take a directory tree that looks like:
# /data/conversion/inbox
# /data/conversion/tmp
# /data/conversion/complete
# It will find any files in the inbox, use ffmpeg to convert them into .wav files, then move the result to the complete folder before cleaning up the inbox and tmpdir.
# It will handle nested folders - say, music files within artist and album directories.
require 'find'
paths_to_rm = []
Find.find("/data/conversion/inbox/") do |path|