Skip to content

Instantly share code, notes, and snippets.

View mcfiredrill's full-sized avatar
💭
working on datafruits

Tony Miller mcfiredrill

💭
working on datafruits
View GitHub Profile
@mcfiredrill
mcfiredrill / aliases in .bashrc
Last active January 31, 2022 14:04
dark.sh/light.sh
alias dark=$HOME/bin/dark.sh
alias light=$HOME/bin/light.sh
@mcfiredrill
mcfiredrill / tmux_completion.bash
Created January 24, 2013 01:18
simple tmux bash completion
# completion for tmux session names
function _tmux_complete_session() {
local cur
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "$(tmux ls | cut -f 1 -d ':')" -- "${cur}") )
}
alias td='tmux a -d -t'
complete -F _tmux_complete_session td
@mcfiredrill
mcfiredrill / app.rb
Last active December 12, 2015 04:09
sinatra streaming
require "sinatra"
get '/' do
erb :index
end
get '/stream', provides: "text/event-stream" do
puts "hi"
stream(:keep_open) do |out|
1000.times do |i|
@mcfiredrill
mcfiredrill / gist:4951364
Last active September 15, 2017 22:52
retrieving metadata from icecast streams for an html5 audio player
possible solutions
===================
1. On the server side, make a request to the stream with this request header:
Icy-MetaData:1
This will return a response header like this:
icy-metaint:8192
This supposedly tells you there is a metadata packet in the stream every 8192 bytes.
You could read in the metadata in a program on the server this way, and when it changes,
send a message to the client using SSEs or something.
@mcfiredrill
mcfiredrill / test.liq
Created February 17, 2013 07:43
on_connect error
set("log.file",false)
set("log.stdout",true)
set("log.level",3)
set("harbor.bind_addr","0.0.0.0")
def harbor_connect(headers)
log(headers)
log("harbor connect")
end
@mcfiredrill
mcfiredrill / app.rb
Last active December 14, 2015 06:18
modular sinatra app taken from here => https://github.com/jfeaver/modular-sinatra/
class Datafruits < Sinatra::Base
@@my_app = {}
def self.new(*) self < Datafruits ? super : Rack::URLMap.new(@@my_app) end
def self.map(url) @@my_app[url] = self end
# do all config stuff in this file
enable :sessions
use Rack::Flash
class ApplicationController < Datafruits
@mcfiredrill
mcfiredrill / ideas
Last active December 15, 2015 04:19
push metadata updates from liquidsoap to http stream in sinatra
* redis pub/sub
* no support for redis in liquidsoap, could call a ruby script?
* osc?
* supported directly in liquidsoap
* unix socket
* would require local sinatra app to communicate with the outside world
* write to file, poll filesystem with fs-events gem
* would require local sinatra app to communicate with the outside world
█▓▒░tony@kiwi░▒▓█ ~$ curl -i -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST -d '{"user":{"login":"tony", "password":"f0ibles1"}}' http://localhost:3000/login
HTTP/1.1 406 Not Acceptable
Content-Type: application/json; charset=utf-8
X-Ua-Compatible: IE=Edge
Cache-Control: no-cache
X-Request-Id: e0d06fea7951ed28ecd1c788612f55e9
X-Runtime: 0.151305
Server: WEBrick/1.3.1 (Ruby/1.9.3/2013-02-13)
Date: Sat, 30 Mar 2013 20:51:24 GMT
@mcfiredrill
mcfiredrill / base.rb
Created April 16, 2013 15:28
resque's wacky failure backend architecture
module Resque
module Failure
class Base
end
end
end
make[1]: Entering directory `/z/src/butt-0.1.12/src'
g++ -o butt FLTK/Fl_ILM216.o FLTK/Fl_Native_File_Chooser.o FLTK/fl_callbacks.o F
LTK/fl_funcs.o FLTK/flgui.o butt.o cfg.o icecast.o lame_encode.o parseconfig.o p
ort_audio.o ringbuffer.o shoutcast.o sockfuncs.o strfuncs.o timer.o util.o vorbi
s_encode.o wav_header.o -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lmp
3lame -L/usr/local/lib `` -lpthreadGC2 -lportaudio -mwindows /usr/local/lib/
libfltk_images.a /usr/local/lib/libfltk_png.a /usr/local/lib/libfltk_z.a /usr/lo
cal/lib/libfltk_jpeg.a /usr/local/lib/libfltk.a -lole32 -luuid -lcomctl32 -lvorb
isenc -lvorbis -logg -lws2_32 -lmp3lame
FLTK/Fl_ILM216.o: In function `ZN9Fl_ILM2166handleEi':