Skip to content

Instantly share code, notes, and snippets.

#! /usr/bin/env python
import sys
import time
import pychromecast
requested_volume = float(sys.argv[1]) if len(sys.argv) > 1 else None
cast = pychromecast.get_chromecast(friendly_name="Roo's Chromecast")
#! /bin/bash
# e.g. ./nova http://www.novamov.com/video/f2b75513d834f
# opens a browser and presents a url for the flv file
curl $1 \
| grep "flashvars\.\(domain\|file\|filekey\)" \
| tr -d '\n' \
| perl -pe 's/.*flashvars\.domain="(.*)";.*flashvars\.file="(.*)";.*flashvars\.filekey="(\S+)";/$1\/api\/player\.api\.php\?file=$2&key=$3/' \
| xargs open
%4|1402213840.181|PROTOERR|rdkafka#consumer-0| 192.168.51.10:9092/1: Protocol parse failure at rd_kafka_messageset_handle:2703
%4|1402213840.182|PROTOERR|rdkafka#consumer-0| 192.168.51.10:9092/1: expected 18 bytes > 14 remaining bytes
%4|1402213840.182|PROTOERR|rdkafka#consumer-0| 192.168.51.10:9092/1: Previous parsing error for topic benchmark [0]
%4|1402213840.199|PROTOERR|rdkafka#consumer-0| 192.168.51.10:9092/1: Previous parsing error for topic benchmark [0]
%4|1402213840.219|PROTOERR|rdkafka#consumer-0| 192.168.51.10:9092/1: Previous parsing error for topic benchmark [0]
%4|1402213840.235|PROTOERR|rdkafka#consumer-0| 192.168.51.10:9092/1: Previous parsing error for topic benchmark [0]
%4|1402213840.255|PROTOERR|rdkafka#consumer-0| 192.168.51.10:9092/1: Previous parsing error for topic benchmark [0]
%4|1402213840.274|PROTOERR|rdkafka#consumer-0| 192.168.51.10:9092/1: Protocol parse failure at rd_kafka_messageset_handle:2703
%4|1402213840.274|PROTOERR|rdkafka#consumer-0| 192.168.51.10:9092/1: expected 18 b
Code move event for unknown code: 0x3db110130360
Code move event for unknown code: 0x3db11017bb20
Code move event for unknown code: 0x3db110263de0
Code move event for unknown code: 0x3db110460540
Code move event for unknown code: 0x3db110560540
Code move event for unknown code: 0x3db11065e5c0
Code move event for unknown code: 0x3db11075dc80
Code move event for unknown code: 0x3db11095c960
Statistical profiling result from v8.log, (8345 ticks, 267 unaccounted, 0 excluded).
[librdkafka (master *)]$gcc-4.9 -v
Using built-in specs.
COLLECT_GCC=gcc-4.9
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc49/4.9-20131229/libexec/gcc/x86_64-apple-darwin13.0.0/4.9.0/lto-wrapper
Target: x86_64-apple-darwin13.0.0
Configured with: ../configure --build=x86_64-apple-darwin13.0.0 --prefix=/usr/local/Cellar/gcc49/4.9-20131229 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.9 --with-gmp=/usr/local/opt/gmp4 --with-mpfr=/usr/local/opt/mpfr2 --with-mpc=/usr/local/opt/libmpc08 --with-cloog=/usr/local/opt/cloog018 --with-isl=/usr/local/opt/isl011 --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --enable-plugin --disable-nls --disable-multilib
Thread model: posix
gcc version 4.9.0 20131229 (experimental) (GCC)
[librdkafka (master *)]$g++-4.9 -v
Using built-in specs.
[librdkafka (master)]$CC=clang CXX=clang++ ./configure --reconfigure && make clean all
Reconfiguring: /Users/leroix/librdkafka/configure
using cache file config.cache
checking for OS or distribution... ok (osx)
checking for C compiler from CC env... ok (cached)
checking for C++ compiler from CXX env... ok (cached)
checking executable ld... ok (cached)
checking executable nm... ok (cached)
checking executable objdump... failed (disable)
checking executable strip... ok (cached)
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}html{line-height:1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing:0}caption,th,td{text-align:left;font-weight:normal;vertical-align:middle}q,blockquote{quotes:none}q:before,q:after,blockquote:before,blockquote:after{content:"";content:none}a img{border:none}.fb_edge_widget_with_comment span.fb_edge_comment_widget iframe.fb_ltr{display:none}.rafl-powered{display:-moz-inline-stack;display:inline-block;vertical-align:middle;*vertical-align:auto;zoom:1;*display:inline;width:100%;font-size:10px;color:#999;text-a
if (ryan === "poor climber")
console.log('SHINER');
@leroix
leroix / check-remote-sync.sh
Created February 5, 2014 18:15
Git: check if a branch is sync'd with a branch of the same name in a remote repo e.g. `check-remote-sync development origin`. Returns nothing if in sync.
#!/bin/bash
LOCAL_BRANCH=$1
REMOTE_BRANCH="${2:-origin}/$1"
if [ x"$(git rev-parse $LOCAL_BRANCH)" != x"$(git rev-parse $REMOTE_BRANCH)" ]
then
echo "$LOCAL_BRANCH is not in sync with $REMOTE_BRANCH. You may want to rebase or push first."
fi
@leroix
leroix / ThreadPool.hs
Last active December 21, 2015 14:59
a multithreaded udp receiver with graceful exit
-- Forked from ThreadPool in Control-Engine and made to use TChan
-- instead of Chan
-- http://new-hackage.haskell.org/package/Control-Engine-1.1.0.1/docs/src/Control-ThreadPool.html
module ThreadPool
( threadPool
, threadPoolIO
) where
import Control.Monad (forever, forM_)