Skip to content

Instantly share code, notes, and snippets.

#EXTM3U
#EXT-X-VERSION:4
## Created with Unified Streaming Platform(version=1.9.5)
# AUDIO groups
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio-aacl-50",NAME="English",LANGUAGE="en",AUTOSELECT=YES,DEFAULT=YES,CHANNELS="1"
# variants
#EXT-X-STREAM-INF:BANDWIDTH=297000,CODECS="mp4a.40.2,avc1.4D001F",RESOLUTION=640x480,FRAME-RATE=25,AUDIO="audio-aacl-50",CLOSED-CAPTIONS=NONE
asset-audio=50000-video=230000.m3u8?grs=g147&dcp_ver=aos4&audiostream=1555_280.f4v:50000&videostream=1555_280.f4v:230000,1555_450.f4v:400000,1555_825.f4v:775000&AliasPass=c129-atr-vod-sms.secure.footprint.net
@fuzzmonkey
fuzzmonkey / download_google_drive.rb
Created October 1, 2017 14:30
Ruby script for downloading a file from google drive given a public file id
# usuage ruby download_google_drive.rb <FILE ID>
fileid = ARGV[0]
confirm_code = `wget --save-cookies cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=#{fileid}' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\\1\/p'`
`wget --load-cookies cookies.txt 'https://docs.google.com/uc?export=download&confirm=#{confirm_code}&id=#{fileid}'`
package main
import(
"strings"
"github.com/DavidHuie/quartz/go/quartz"
)
var scores = map[string]int{
"A": 1, "B": 3, "C": 3, "D": 2,
"E": 1, "F": 4, "G": 2, "H": 4,
@fuzzmonkey
fuzzmonkey / robot.rb
Created December 8, 2016 23:03
robots! ruby!
class Robot
DIRECTIONS = {
1 => "NORTH",
2 => "EAST",
3 => "SOUTH",
4 => "WEST"
}
attr_accessor :grid_size, :x, :y, :facing
sql := "SELECT * FROM foo WHERE foo.name = $1"
args = append(args, "fred")
someArg := r.URL.Query().Get("some_arg")
someArg2 := r.URL.Query().Get("some_arg_2")
if someArg != "" {
args = append(args, someArg)
sql += " AND foo.some_arg = $" + strconv.Itoa(len(args))
}
I have a site (it's a rails app) that pulls some data from a variety of sources. It's pretty slow to generate and the customer wanted to deploy it in a windows environment so...The rails app is exported as a static site (it doesn't change very often) using wget -m (mirror).
- It needs to work in IE8 and the excanvas doesn't seem to support fillText (?)
- They have also some users that download the data images directly (e.g somesite.com/race/1/thingincanvas.jpg) for use on other systems
I figured the easiest way to solve all the problems was to generate the images from canvas and embed those instead of the canvas. As i'd have the image files, i could then easily support the second requirement.
The whole thing is a bit bonkers but customers.
@fuzzmonkey
fuzzmonkey / gist:f813cc0435d9ba648fc5
Created December 8, 2014 09:57
git: convert unix line end characters to windows ones
# From the root of your repository remove everything from the index
git rm --cached -r .
# Change the autocrlf setting of the repository (you may want
# to use true on windows):
git config core.autocrlf true
# Re-add all the deleted files to the index
# (You should get lots of messages like:
# warning: CRLF will be replaced by LF in <file>.)
@fuzzmonkey
fuzzmonkey / gist:77a0d1065043a5e4e387
Created September 1, 2014 18:09
This code generates three SQL queries in ActiveRecord. Not what i was expecting..
foos = Foo.where(params)
if foos.any?
# Foo Load (0.1ms) select count from foos where params
if foos.size == 1 && foos.first.attribute == 'bar'
# Foo Load (0.1ms) select count from foos where params
# Foo Load (0.1ms) select * from foos where params
end
end
@fuzzmonkey
fuzzmonkey / gist:8806903
Created February 4, 2014 16:18
Basic riemann config
; -*- mode: clojure; -*-
; vim: filetype=clojure
(logging/init :file "/var/log/riemann/riemann.log")
; Listen on the local interface over TCP (5555), UDP (5555), and websockets
; (5556)
(let [host "127.0.0.1"]
(tcp-server :host host)
(udp-server :host host)
//pin numbers
int LEFTRIGHT_DIR = 10;
int LEFTRIGHT_PWM = 9;
void setup() {
pinMode(LEFTRIGHT_DIR, OUTPUT);
pinMode(LEFTRIGHT_PWM, OUTPUT);
Serial.begin(9600);