Skip to content

Instantly share code, notes, and snippets.

View turboladen's full-sized avatar
🌮

Steve Loveless turboladen

🌮
View GitHub Profile
require 'fileutils'
require 'benchmark'
require './lib/pants'
Benchmark.bm do |x|
Pants::Logger.log = false
x.report("pants:") do
tee = Pants.new("/Users/Steveloveless/Music/iTunes/iTunes Media/Music/Ana Voog/Hollywood/01 Hollywood (Juno Reactor 7_ Mix).mp3") do |tee|
@turboladen
turboladen / gist:4316067
Created December 17, 2012 05:50
EventMachine repeater
class Receiver < EventMachine::Connection
attr_reader :data_channel
def initialize
@data_channel = EM::Channel.new
end
def receive_data(data)
@data_channel << data
end
@turboladen
turboladen / gist:4274322
Created December 13, 2012 05:42
UDP stream copier. Now you can pass in a destination IP and port: $ ruby io_copier.rb 192.168.10.5 1234
# I was able to stream an .m4v file using VLC using this (just to verify it works).
#
# 1. Use VLC's Streaming/Exporting Wizard:
# a) Stream to network
# b) Select a stream (choose the file you want to send)
# c) Streaming method: UDP unicast; destination 127.0.0.1
# d) (Don't transcode. ...well, unless you want to I guess?)
# e) Encapsulation format: MPEG_TS (my only choice)
# f) (No additional options)
# 2. Run this script. It takes 2 args: destination_ip, destination_port.
@turboladen
turboladen / gist:3173856
Created July 25, 2012 01:31
stuffer test
Given /^a set of test results from Tim$/ do
@suite_result = {
component_name: 'stuffer',
suite_name: 'Stuffer Acceptance',
build_version: Stuffer::VERSION,
results: [
{
'Stuffer Acceptance Test Feature' => {
'Stuffer Acceptance Test #1' => {
'Step 1' => :passed,
@turboladen
turboladen / tester_spec.rb
Created July 11, 2012 18:41
RSpec 2.11 .any_instance.should_not_receive bug
class Tester
def initialize(dont_do_it)
do_something unless dont_do_it == false
end
def do_something
puts "Doing it..."
end
end
@turboladen
turboladen / gist:1673868
Created January 25, 2012 00:54
vagrant up not importing
hudson@systools-02:~/fsroot/workspace/FED VM (x86)$ vagrant up
INFO vagrant: `vagrant` invoked: ["up"]
DEBUG vagrant: Creating Vagrant environment
INFO environment: Environment initialized (#<Vagrant::Environment:0x000000012a7050>)
INFO environment: - cwd: /home/hudson/fsroot/workspace/FED VM (x86)
INFO environment: Home path: /home/hudson/.vagrant.d
DEBUG vagrant: Loading environment
INFO environment: Loading configuration...
DEBUG loader: Set :default = "/home/hudson/.rvm/gems/ruby-1.9.3-p0/gems/vagrant-0.9.3/config/default.rb"
DEBUG loader: Populating proc cache for "/home/hudson/.rvm/gems/ruby-1.9.3-p0/gems/vagrant-0.9.3/config/default.rb"
@turboladen
turboladen / gist:1375796
Created November 18, 2011 06:57
(BD)SM install errors
[sloveless@sloveless-mbp:opt]$ version=$(curl https://bdsm.beginrescueend.com/releases/latest.txt) &&
> curl -O https://bdsm.beginrescueend.com/releases/sm-${version}.tar.bz2 &&
> tar jxf sm-${version}.tar.bz2 &&
> cd sm-${version} &&
> ./install
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7 100 7 0 0 15 0 --:--:-- --:--:-- --:--:-- 17
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
@turboladen
turboladen / ssh_command_runner.yaml
Created September 13, 2011 18:21
Yucky gemspec
--- !ruby/object:Gem::Specification
name: ssh_command_runner
version: !ruby/object:Gem::Version
hash: 7
prerelease:
segments:
- 3
- 0
- 0
version: 3.0.0
$:.push File.expand_path("../lib", __FILE__)
require 'ssh_command_runner/version'
Gem::Specification.new do |s|
s.name = "ssh_command_runner"
s.version = SSHCommandRunner::VERSION
s.homepage = SSHCommandRunner::WWW
s.authors = ["Pelco System Software Automation Team"]
s.email = ["system-tools@lists.pelco.org"]
s.description = "This is a RubyGem that simply wraps net-ssh with some " +
@turboladen
turboladen / tweets to html
Created February 18, 2011 19:01
Gets all tweets from a user into an single string of HTML
# Be sure to `gem install twitter` first, of course...
require 'rubygems'
require 'twitter'
tweets = ""
pages = 10 # The Twitter API paginates responses...
# Get all the tweets to a single String, where each is surrounded in HTML
(1..pages).each do |page|