Skip to content

Instantly share code, notes, and snippets.

require 'thread'
class Actor
def initialize(send_queue, recv_queue)
@send_queue = send_queue
@recv_queue = recv_queue
end
def send(sym, *args)
@send_queue.push([sym,*args])
require 'rubygems'
require 'builder'
xml = Builder::XmlMarkup.new
@recent_items = [
{:title => "Item Title",
:description => "Item Description",
:pub_date => Date.today,
:guid => "10893750189756019760127",
require 'rubygems'
require 'builder'
xml = Builder::XmlMarkup.new
@recent_items = [
{:title => "Item Title",
:description => "Item Description",
:pub_date => Date.today,
:guid => "10893750189756019760127",
bitstring = <<-BITS
110101001110100001100101101000000101010111101110
011010011111011001100101011100101111001101101001
011101001111100110100000011011110110011010100000
110001011110010001101001111011101110001011110101
011100101110011111101000101000000111011101101111
111101010110110011100100101000000110110001101001
111010110110010110100000011101000110111110100000
011101001110100011100001111011101110101110100000
011010010111010011110011101000001111001111110101
;; Some fairly nasty elisp for a very simple purpose: to set up a new clojure-project
;; and run clojure-project in it. For those of us who Know Not The Ways Of Maven.
(defun clojure-project-setup (path)
"Set up a project structure for clojure-project and copy any
interesting-looking jars into lib/."
(interactive (list
(ido-read-directory-name
"Project root: "
(locate-dominating-file default-directory "~"))))
@regularfry
regularfry / gist:1073970
Created July 9, 2011 21:12
Thoughts on a first pass-through of the Sproutcore getting started guide
=begin
I worked through this Getting Started guide on 2011-07-08, on an
up-to-date Debian Squeeze desktop with ruby 1.9.2-p180 installed via
RVM, and Sproutcore 1.6.0.rc.2 installed via Rubygems. The Getting
Started guide was the first literature on Sproutcore I exposed myself
to. I've interspersed notes about where I got confused in =begin/=end
blocks throughout, mostly in the form of rhetorical questions as they
appeared in my mind at the time. I did not watch the screencast.
@regularfry
regularfry / gist:1600582
Created January 12, 2012 13:41
lein test slowness
$ lein version
Leiningen 1.6.2 on Java 1.6.0_18 OpenJDK 64-Bit Server VM
$ lein new foo
Created new project in: /home/zander/scratch/foo
Look over project.clj and start coding in foo/core.clj
$ cd foo
$ lein deps
Copying 1 file to /home/zander/scratch/foo/lib
$ time lein test
@regularfry
regularfry / gist:1761661
Created February 7, 2012 20:09
Basic pulseaudio initialisation
/* For instance... */
#define BUFSIZE 1024
pa_simple *init_pulse(int *perror)
{
/* The sample type to use.
This gives us 2 channels of 8 bits per channel. */
static const pa_sample_spec ss = {
.format = PA_SAMPLE_U8,
.rate = 44100,
@regularfry
regularfry / doff.py
Created February 15, 2012 15:15
hg doff
"""doff
Touches its forelock.
"""
from random import randint
from mercurial import commands
commands.norepo += " doff"
greetings=[
@regularfry
regularfry / puppet.out
Created August 29, 2012 13:20
Puppet output
info: Loading facts in bytemark
debug: importing '/usr/share/puppet/modules/bma2_dev/manifests/init.pp' in environment production
debug: Automatically imported bma2_dev from bma2_dev into production
debug: importing '/usr/share/puppet/modules/bma2/manifests/init.pp' in environment production
debug: Automatically imported bma2 from bma2 into production
debug: Failed to load library 'selinux' for feature 'selinux'
debug: Scope(Class[Bma2]): Retrieving template bma2/bma2.vhost.erb
debug: template[/usr/share/puppet/modules/bma2/templates/bma2.vhost.erb]: Bound template variables for /usr/share/puppet/modules/bma2/templates/bma2.vhost.erb in 0.00 seconds
debug: template[/usr/share/puppet/modules/bma2/templates/bma2.vhost.erb]: Interpolated template /usr/share/puppet/modules/bma2/templates/bma2.vhost.erb in 0.00 seconds