Skip to content

Instantly share code, notes, and snippets.

@hopbit
hopbit / gist:b8d816e829edae60a705
Created October 14, 2015 22:14 — forked from darinwilson/SonicPiDrumMachine
Sonic Pi Drum Machine
#########################################
## Sonic Pi Drum Machine
## coded by Darin Wilson
##
use_bpm 95
in_thread(name: :drum_machine) do
# choose your kit here (can be :acoustic, :acoustic_soft, :electro, :toy)
@hopbit
hopbit / play-all-samples.rb
Created November 30, 2015 22:00
play all sonic pi samples
format = "there are %d samples" % all_sample_names.size
puts format
for voicenumber in 0..all_sample_names.size-1 do
puts voicenumber
voice = all_sample_names[voicenumber]
sample voice
sleep sample_duration voice
end
@hopbit
hopbit / gist:5212170
Last active December 15, 2015 05:49
test
var gitKataBestCommiter = {
/**
* @type {string}
* @private
*/
searchOnBitBucket_: 'https://api.bitbucket.org/1.0/repositories/wojtassj/git-kata-registration/changesets',
/**
* @param {ProgressEvent} e The XHR ProgressEvent.

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
for i in {1..9}
do
wget "https://raspberrypi.org/magpi-issues/MagPi0$i.pdf"
done
for i in {10..42}
do
wget "https://raspberrypi.org/magpi-issues/MagPi$i.pdf"
done
# http://www.cyberciti.biz/faq/bash-for-loop/
@hopbit
hopbit / hr_max.rb
Created February 23, 2016 21:41
This simple Ruby script calculates HR Max based on formula created by Sally Edwards.
# calculates maximum heart rate for woman
# formula by sally edwards
def hr_max_woman(age, weight)
return 210 - 0.5 * age - 0.022 * weight
end
# calculates maximum heart rate for man
# formula by sally edwards
def hr_max_man(age, weight)
return 210 - 0.5 * age - 0.022 * weight + 4
@hopbit
hopbit / _convert_mp3_filenames_imported_with_itunes.py
Last active March 8, 2016 07:58
simple python script that converts mp3 files imported with itunes in "my way"
# coding=UTF-8
import os, shutil
# needs python2.7
# works only with albums that are NOT marked as compilations
# --------------------------------------------------------------
# usage:
# cd %itunes_library%\Music # cd $itunes_library/Music
# python _convert_mp3_filenames_imported_with_itunes.py
@hopbit
hopbit / map-sortby-example.rb
Created March 17, 2016 01:02
ruby map & sort by example
# play it with Sonic Pi v.2.9 (http://sonic-pi.net)
notes = { dd: 74, c: 72, bbbbbbb: 83, ffff: 77, aaaaaa: 81, cccccccc: 84, eee: 76, ggggg: 79 }
notes.keys.map { | key | key.to_sym }.sort_by(&:length).each { |key|
play_pattern [notes[key]]
}
@hopbit
hopbit / sonicpi-crash-course.txt
Created March 26, 2016 20:31 — forked from hzulla/sonicpi-crash-course.txt
Crash into Sonic Pi: Learn to code music in less than 30 minutes
# -------------------------------------------
# CRASH INTO SONIC PI!
# Learn to code music in less than 30 minutes
# -------------------------------------------
# - download Sonic Pi from sonic-pi.net
# - copy and paste these code snippets
# - change and experiment with the snippets
# - go!
# -------------------------------------------
# These snippets were made for a workshop to
@hopbit
hopbit / ambient1
Created April 13, 2016 10:07 — forked from darinwilson/ambient1
Ambient experiment using Sonic Pi
# Ambient experiment for Sonic Pi (http://sonic-pi.net/)
#
# The piece consists of three long loops, each of which plays one of
# two randomly selected pitches. Each note has different attack,
# release and sleep values, so that they move in and out of phase
# with each other. This can play for quite awhile without
# repeating itself :)
live_loop :note1 do
use_synth :hollow