Skip to content

Instantly share code, notes, and snippets.

@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
@regularfry
regularfry / gist:4030956
Created November 7, 2012 11:28
rvm jruby-1.5.1 fail
$ rvm install jruby-1.5.1 --disable-binary
jruby-1.5.1 - #downloading jruby-bin-1.5.1, this may take a while depending on your connection...
Error running '/home/zander/.rvm/scripts/fetch http://jruby.org.s3.amazonaws.com/downloads/1.5.1/jruby-bin-1.5.1.tar.gz', please read /home/zander/.rvm/log/jruby-1.5.1/fetch.log
$ cat /home/zander/.rvm/log/jruby-1.5.1/fetch.log
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 11.5M 100 11.5M 0 0 47982 0 0:04:11 0:04:11 --:--:-- 48236
Downloaded archive checksum did not match, archive was removed!
If you wish to continue with not matching download add '--verify-downloads 2' after the command.
[11:38:20] zander@pancake: ~/tmp/rack/rack-jetty master!
$ gem list rake
*** LOCAL GEMS ***
rake (10.0.2)
[11:38:31] zander@pancake: ~/tmp/rack/rack-jetty master!
$ gem uninstall rake --version=10.0.2
INFO: gem "rake" is not installed
@regularfry
regularfry / pdns_remote_http.md
Created November 8, 2015 18:00
pdns_server remote backend problem
$ jruby -d -S gem install jruby-openssl
Exception `LoadError' at /home/zander/.rubies/jruby-1.5.1/lib/ruby/1.8/Win32API.rb:2 - Win32API only supported on win32
Exception `Gem::LoadError' at /home/zander/.rubies/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems.rb:777 - Could not find RubyGem jruby-openssl (>= 0)
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
Exception `Gem::LoadError' at /home/zander/.rubies/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems.rb:777 - Could not find RubyGem jruby-openssl (>= 0)
Exception `LoadError' at /home/zander/.rubies/jruby-1.5.1/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/x509.rb:8 - OpenSSL::X509 requires the jruby-openssl gem
Exception `Gem::LoadError' at /home/zander/.rubies/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems.rb:777 - Could not find RubyGem test-unit (>= 0)
$ gem install ./jruby-openssl-0.7.7.gem
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
Fetching http://rubygems.org/latest_specs.4.8.gz
Fetching https://rubygems.org/latest_specs.4.8.gz
/home/zander/.rubies/jruby-1.5.1/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:8: OpenSSL::SSL requires the jruby-openssl gem (LoadError)
from /home/zander/.rubies/jruby-1.5.1/lib/ruby/site_ruby/shared/jruby/openssl/autoloads/ssl.rb:124:in `use_ssl='
from /home/zander/.rubies/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:248:in `connection_for'
from /home/zander/.rubies/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:329:in `request'
from /home/zander/.rubies/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:286:in `open_uri_or_path'
@regularfry
regularfry / gemstash_problem.shell
Last active December 21, 2015 17:00
gemstash problem
$ cat /etc/nginx/sites-available/gemstash.conf
server {
listen 80;
listen [::]:80;
server_name gemstash;
keepalive_timeout 0;
location / {
proxy_pass http://127.0.0.1:9292;
@regularfry
regularfry / pmbi
Created October 10, 2013 01:35
Poor Man's Bundle Install
#!/usr/bin/env ruby
lockfile=ARGV.shift
sources=[]
gems=[]
File.foreach(lockfile) do |line|
case line
when /^ remote: (.*)$/
sources << $1
when /^ (\S+) \((.*)\)$/