Skip to content

Instantly share code, notes, and snippets.

@brookemckim
brookemckim / wowza_error.log
Created May 26, 2011 14:06
Wowza Error Log
WARN server comment 2011-05-26 09:29:14 - - - 31.366 - - - - - - - - LiveStreamPacketizerSmoothStreaming.handlePacket[lomalinda/_definst_/3-1]: Fragment duration greater than suggested range of 1-4 seconds. Adjust keyframe interval accordingly: Fragment durations: [4.9,4.9,4.9]
WARN server comment 2011-05-26 09:29:14 - - - 31.367 - - - - - - - - LiveStreamPacketizerSmoothStreaming.handlePacket[lomalinda/_definst_/3-2]: Fragment duration greater than suggested range of 1-4 seconds. Adjust keyframe interval accordingly: Fragment durations: [4.9,4.9,4.9]
WARN server comment 2011-05-26 09:29:14 - - - 31.367 - - - - - - - - LiveStreamPacketizerSmoothStreaming.handlePacket[lomalinda/_definst_/3-3]: Fragment duration greater than suggested range of 1-4 seconds. Adjust key
@brookemckim
brookemckim / mongo.rb
Created June 6, 2011 00:38
MongoDB Initializer
require 'yaml'
config = YAML.load_file(File.expand_path(File.join(SINATRA_ROOT, 'config', 'mongo.yaml')))
db = config[ENV['RACK_ENV'].downcase]
uri = "mongodb://#{db['username']}:#{db['password']}@#{db['host']}:#{db['port']}/#{db['database']}"
DB = Mongo::Connection.from_uri(uri).db(db['database'])
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Pragma" content="no-cache">
<SCRIPT language="javascript">
window.self.focus()
</SCRIPT>
<title>RSS_Weather02_newcrawl</title>
@brookemckim
brookemckim / builder.rb
Created July 13, 2011 17:54
Build XML from template w/ Nokogiri
template = File.read('/path/to/template')
builder = Nokogiri::XML::Builder.new do |xml|
eval File.read(template)
end
builder.to_xml
@brookemckim
brookemckim / environment.rb
Created August 10, 2011 18:52
Fix for rubygems < 1.3.6 & older verions of rails
if Gem::VERSION >= "1.3.6"
module Rails
class GemDependency
def requirement
r = super
(r == Gem::Requirement.default) ? nil : r
end
end
end
end
@brookemckim
brookemckim / event.rb
Created August 15, 2011 20:54
duration_as_hhmm
def duration_as_hhmm
seconds = adjusted_duration
hours = (seconds / 3600).to_i
minutes = (seconds - (hours * 3600)) / 60
# hhmm
"#{'%02d' % hours}#{'%02d' % minutes % 60}"
end
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/expert_recipe string \
boot-root :: \
500 50 500 ext4 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
@brookemckim
brookemckim / changer.rb
Created September 15, 2011 20:08
Swapping multi-bitrate HLS playlists with a single sub-playlist
require 'nokogiri'
require 'open-uri'
require 'httparty'
require 'pathname'
class CategoryItem
attr_accessor :title, :description, :feed, :element
def initialize(node)
@element = node
@brookemckim
brookemckim / gradient_calc.rb
Created October 6, 2011 02:10
Calculate a Gradient
gradient_percentage = 0.10
# Split into RGB
red = backgroundcolor[0,2].hex
green = backgroundcolor[2,2].hex
blue = backgroundcolor[4,2].hex
# Add percentage (could subtract if you want to darker)
red += (red * gradient_percentage).to_i
green += (green * gradient_percentage).to_i
@brookemckim
brookemckim / nginx
Created March 20, 2012 20:10
nginx init.d script
#! /bin/sh
##
# Generated by Chef
# <%= Time.now %>
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog