Skip to content

Instantly share code, notes, and snippets.

@xavriley
xavriley / README.md
Last active December 30, 2023 12:17
Original NES Mario Theme for Sonic Pi

Making Chiptune Music using Sonic Pi v2.0

Warning: this might not work on a RaspberryPi yet

I was curious about making retro gaming sounds using Sonic Pi. A couple of months and a lot of Googling later, here's the original Mario Bros theme as it was heard on the NES console.

I'm (just about) old enough to remember rushing home from school to play this game at Philip Boucher's house, sitting cross-legged in front of the TV till my feet got pins and needles. Working out how to recreate it for Sonic Pi was a lot of fun!

Getting the sounds of the NES chip

@xavriley
xavriley / auto_dubstep.rb
Created June 10, 2014 21:33
Auto generating dubstep with Sonic Pi
# DUBSTEP
# Combines ideas from my other gists
current_bpm = 140.0
use_bpm current_bpm
# WOBBLE BASS
define :wob do
use_synth :dsaw
lowcut = note(:E1) # ~ 40Hz
highcut = note(:G8) # ~ 3000Hz
@xavriley
xavriley / clyde_stubblefield.rb
Created June 10, 2014 21:15
Funky drummer with Sonic Pi
# The funky drummer
# The aim here is to experiment with
# a) sequencing drums
# b) playing with 'time feel' which is
# music-speak for how the beat feels,
# ranging from robotic (0.0 swing_time)
# to ultra funky Fresh Prince of Bel Air
# theme tune style (0.2+ swing_time)
current_bpm = 180.0
@xavriley
xavriley / deep_note.rb
Last active April 21, 2020 02:36
Recreating the THX sound with SonicPi
# THX Deep Note
# Second draft
# see http://www.earslap.com/article/recreating-the-thx-deep-note.html
time = 10
wait_time = (time / 3)
synths = []
rand_note = -> { rrand(note(:A2), note(:A4)) }
with_fx :normaliser, amp: 0.5 do
use_synth :dsaw
#!/usr/bin/env python
# Quick and dirty demonstration of CVE-2014-0160 by
# Jared Stafford (jspenguin@jspenguin.org)
# Modified so that it finds cookies
import sys
import struct
import socket
import time
import select
@jacklynrose
jacklynrose / RubyMotionTheRailsWay.md
Last active August 29, 2015 13:57
Ideas on how to write RubyMotion apps the "Rails" way

RubyMotion The "Rails" Way

This is a current proposal that I'd like your feedback on for how we can clean up how we write RubyMotion applications. It's purely conceptual at the moment, and there would have to be some framework development to make this work the way described here.

Please submit your feedback, as a joint effort we can clean up our RubyMotion applications and make it easier for Rails developers to expand their skills into RubyMotion development.

Goals

The main points of this are:

@rkh
rkh / warning_filter.rb
Created February 21, 2014 07:45
Run Ruby with warnings enabled. Without going crazy.
require 'delegate'
module Support
class WarningFilter < DelegateClass(IO)
def write(line)
super if line !~ /^\S+gems\/ruby\-\S+:\d+: warning:/
end
end
end
@jamonholmgren
jamonholmgren / user_controller.rb
Created October 23, 2013 19:06
Cleaner params
class UserController < ApplicationController
def create
@user = User.create(UserInput.new(params).create)
end
def update
@user = User.find(params[:id].to_i)
@user.update_attributes(UserInput.new(params).update)
end
@rbnpi
rbnpi / A_README SONIC_PI PLAY FILES
Last active June 17, 2017 01:14
Sonic-Pi music files for Raspberry PiGraphic Desktop
THESE FILES WERE WRITTEN FOR SONIC PI VERSION 1
THEY WILL REQUIRE REVISION TO WORK ON VERSION 2
I HAVE OTHER FILES FOR VERSION 2 POSTED ON MY BLOG
SOME OF THESE FILES ARE POSTED THERE IN REVISED VERSIONS
http://rbnrpi.wordpress.com
Posted here will be music files for use with Sonic-Pi on the Raspberry Pi.
If you have the Sonic-Pi music program isntalled (it is on the latest distribution for Raspian) you can start it up from the Graphic Desktop (there is a link under Education on the Start Menu). You can then copy and past the contents of one of the play files into one of the 8 workspace windows and click play to play it.
@kwhinnery
kwhinnery / buble.js
Created March 5, 2013 19:28
Bublé - a shitty version of Sinatra in 50 lines of node.js code.
var http = require('http'),
url = require('url');
module.exports = function(ctx) {
//Initially the global scope, but will be overridden per request
var context = ctx || this,
routes = {};
//Allow users to handle a GET
context.get = function(route, handler) {