Skip to content

Instantly share code, notes, and snippets.

#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p
#EXTINF:-1,BBC - Radio 2
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p
#EXTINF:-1,BBC - Radio 3
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-aac-lc-a/format/pls/vpid/bbc_radio_three.pls
#EXTINF:-1,BBC - Radio 4
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p
#EXTINF:-1,BBC - Radio 5 live
@stengland
stengland / bbcradio.sh
Last active January 11, 2023 14:53
Play BBC Radio with mpd or mplayer from the command line
#!/bin/bash
play() {
playlist="http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_$1.m3u8"
echo $playlist
if mpc
then
mpc add $playlist
mpc play
else
mplayer $playlist

If tmux fails with the message "open terminal failed: missing or unsuitable terminal: rxvt-unicode-256color".

$ ssh remotemachine mkdir -p .terminfo/r
$ scp /usr/share/terminfo/r/rxvt-unicode* remotemachine:.terminfo/r/
@stengland
stengland / vcr.rb
Created June 24, 2013 11:26
Match VCR request body as xml doc rather than string. Will account for different versions of LibXML outputting slightly different XML (mainly empty tags) even though the xml document is equivalent. Uses http://rubygems.org/gems/equivalent-xml
VCR.configure do |c|
c.register_request_matcher :xml_body do |request_1, request_2|
EquivalentXml.equivalent?(request_1.body, request_2.body)
end
c.ignore_localhost = true
c.cassette_library_dir = Rails.root.join("spec", "support", "vcr_cassettes")
c.hook_into :webmock
c.configure_rspec_metadata!
c.default_cassette_options = { match_requests_on: [:method, :uri, :xml_body] }
# c.debug_logger = File.open("#{Rails.root}/log/vcr.log", 'w')
@stengland
stengland / routes.rb
Created August 2, 2013 17:44
External URLs in rails routes
MyApp::Application.routes.draw do
# External urls
scope host: 'www.example.com' do
get 'thing' => 'dev#null', as: :thing
end
end
# Use thing_url in your veiws (thing_path would not include the host)
# thing_url => "http://www.example.com/thing"

Keybase proof

I hereby claim:

  • I am stengland on github.
  • I am stengland (https://keybase.io/stengland) on keybase.
  • I have a public key ASDoWzn341wwe8jS8AX4-2RyL6_ifINxIR5-HRhuLfjQygo

To claim this, I am signing this object:

#!/usr/bin/env ruby
require 'json'
require 'date'
wunderlist = JSON.parse(File.read ARGV[0])
tasks, lists = wunderlist['data']["tasks"], wunderlist['data']["lists"]
tasks.map! do |task|
due_date = task["due_date"]
@stengland
stengland / geo.html
Last active August 4, 2016 13:04
Easy redirects or geo data using https://freegeoip.net, can be used on google tag manager.
<script>
function geo(data) {
if (data.country_code == 'IE') {
window.location = "/ie" + window.location.search;
} else {
dataLayer.push(data);
}
}
</script>
#!/bin/sh
if [ ! -d $HOME/.aurbuild ]; then
mkdir $HOME/.aurbuild
fi
cd $HOME/.aurbuild
if [ -d $1 ]; then
cd $1
git pull