This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby -KU | |
| require 'rubygems' | |
| require 'open-uri' | |
| require 'hpricot' | |
| if ARGV[0] | |
| user = ARGV[0] | |
| url = "http://www.last.fm/user/#{user}" | |
| doc = Hpricot(open(url)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class MY_Exceptions extends CI_Exceptions { | |
| function My_Exceptions() | |
| { | |
| parent::CI_Exceptions(); | |
| } | |
| function log_exception($severity, $message, $filepath, $line) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT s.schema_name, | |
| CONCAT(IFNULL(ROUND((SUM(t.data_length)+SUM(t.index_length)) | |
| /1024/1024,2),0.00),"Mb") total_size, | |
| CONCAT(IFNULL(ROUND(((SUM(t.data_length)+SUM(t.index_length))-SUM(t.data_free))/1024/1024,2),0.00),"Mb") | |
| data_used, | |
| CONCAT(IFNULL(ROUND(SUM(data_free)/1024/1024,2),0.00),"Mb") data_free, | |
| IFNULL(ROUND((((SUM(t.data_length)+SUM(t.index_length))-SUM(t.data_free)) | |
| /((SUM(t.data_length)+SUM(t.index_length)))*100),2),0) pct_used, | |
| COUNT(table_name) total_tables | |
| FROM INFORMATION_SCHEMA.SCHEMATA s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby -wKU | |
| require 'rubygems' | |
| require 'open-uri' | |
| require 'nokogiri' | |
| doc = Nokogiri::HTML(open("http://www.theyworkforthebpi.com/")) | |
| mps_page = Nokogiri::HTML(open("http://www.theyworkforyou.com/mps/")) | |
| names = doc.css("p.tabletext span") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function roundDecimal(n, dp) { | |
| /* round number [n] to [dp] decimal places */ | |
| return Math.round(n * Math.pow(10,dp)) / Math.pow(10,dp); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| description "A blinking light" | |
| author "Tom Armitage - [email protected]" | |
| start on started mountall | |
| stop on shutdown | |
| script | |
| export HOME="/home/pi" | |
| export BUNDLE_GEMFILE="/home/pi/src/blink/Gemfile" | |
| exec bundle exec ruby /home/pi/src/blink/blinken.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| description "A script controlled by upstart" | |
| author "Tom Armitage - [email protected]" | |
| start on started mountall | |
| stop on shutdown | |
| script | |
| export HOME="/home/pi" | |
| exec /home/pi/src/script.sh | |
| end script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'pi_piper' | |
| include PiPiper | |
| pin = PiPiper::Pin.new(:pin => 17, :direction => :out) | |
| pin.off | |
| loop do | |
| pin.on | |
| sleep 1 | |
| pin.off |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'nokogiri' | |
| require 'open-uri' | |
| doc = Nokogiri::HTML(open('http://www.bbc.co.uk/6music')) | |
| artist = doc.css('.realtime-now-playing .rtm-np-artist').text.strip | |
| track = doc.css('.realtime-now-playing .rtm-np-track').text.strip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| load_sample :loop_amen | |
| load_sample :bass_dnb_f | |
| with_fx(:rlpf, cutoff: 40, cutoff_slide: 4) do |c| | |
| one_to_eight = (1..8) | |
| live_loop :drums do |count| | |
| if (count+1) % 8 == 0 | |
| # put a break in every eight bars where you chop the break randomly | |
| slices = one_to_eight.to_a.sort_by { rand } |
OlderNewer