avconv -f x11grab -r 25 -s 1920x1200 -i :0.0 -vcodec libx264 -tune zerolatency -f mpegts udp://127.0.0.1:1234
mplayer -benchmark udp://127.0.0.1:1234
var RailsRoutes = (function(){ | |
return { | |
<% Hash[Rails.application.routes.routes.map{|e| ["#{e.name}_path", e.path.spec.to_s.gsub('(.:format)','')]}].each do |name, path| %> | |
<%= name %>: function(<%= path.scan(/:(\w+)/).map(&:first).join(', ') %>){return <%= "'"+path.gsub(/:(\w+)/){ "'+#{$1}+'" }+"'" %>;}, | |
<% end %> | |
}; | |
})(); |
# encoding: UTF-8 | |
def evaluate(f) | |
return f unless [Array, Proc].include?(f.class) | |
f.map! &method(:evaluate) | |
begin | |
send(f[0],*f[1..-1]) | |
rescue | |
f[1].send(f[0],*f[2..-1]) | |
rescue |
def solve_captcha(image) | |
begin | |
require 'oily_png' | |
rescue LoadError | |
STDERR.puts 'Warning: Gem oily_png not found. Using chunky_png instead. This will be slow!' | |
require 'chunky_png' | |
end | |
img = ChunkyPNG::Image.from_file(image) | |
ps = Hash.new | |
img.width.times{|x| img.height.times{|y| |
module Enumerable | |
# inside the block you can use Thread.exit to stop this execution and Thread.exclusive{...} to synchronize stuff | |
def parallel_map | |
map{|x| Thread.new{ Thread.current[:result] = yield(x) } }.map{|t| t.join; t[:result]} | |
end | |
def parallel_map_in_chunks(chunk_size=8, debug=false, &block) | |
chunks = each_slice(chunk_size).each_with_index | |
chunks.map{|chunk,i| | |
puts "chunk #{i+1}/#{chunks.size}. chunk_size=#{chunk.size}" if debug |
#$!/bin/bash | |
USER=root | |
HOST=rpi | |
BUF=8192 #4096 #16384 | |
(sleep 2 && \ | |
parec -d alsa_output.pci-0000_00_1b.0.analog-stereo.monitor | \ | |
sox --buffer $BUF -t raw -r 44100 -e signed-integer -L -b 16 -c 2 - -t raw - -V0 | \ | |
nc -O $BUF $HOST 44099) & |
@import url(http://fonts.googleapis.com/css?family=Raleway); | |
/*normalize.css v3.0.2*/ | |
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%} | |
body{margin:0} | |
article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block} | |
audio,canvas,progress,video{display:inline-block;vertical-align:baseline} | |
audio:not([controls]){display:none;height:0} | |
[hidden],template{display:none} |
def time_in_words(to, from=Time.now, opts={}) | |
dist = (to.to_i - from.to_i).abs | |
prefix, appendix = from > to ? ['',opts[:appendix]||' ago'] : [opts[:prefix]||'in ', ''] | |
raw = [['years',31557600],['months',2592000],['weeks',604800],['days',86400],['hours',3600],['minutes',60],['seconds',1]].map{|u,s| | |
c = (dist / s).floor | |
dist -= c * s | |
c == 0 ? nil : "#{c} #{c == 1 ? u[0...-1] : u}" | |
}.compact.join(' ') | |
"#{prefix}#{raw}#{appendix}" | |
end |
function foo(args) { | |
var i, j, k; | |
// ... | |
// j acquires some interesting value | |
// Who called foo when j took this interesting value? | |
// | |
var e = new Error('dummy'); | |
var stack = e.stack.replace(/^[^\(]+?[\n$]/gm, '') | |
.replace(/^\s+at\s+/gm, '') |
The purpose of this "howto" is to document how browsing can be done in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.
I welcome contributions and comments on the information contained. Please see the "How to Contribute" section for information on contributing your own knowledge.