Skip to content

Instantly share code, notes, and snippets.

ffmpeg -f alsa -i pulse -acodec pcm_s16le -f x11grab -r 25 -s 1024x768 -i :0.0 /home/arne/record/`date +%Y%m%d-%H%M`.mkv
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
git clone https://github.com/plexus/typecheck
cd typecheck
bundle install
bundle exec rake mutant
require 'benchmark/ips'
# For comparison
class TransientArray < Array
def add(x)
self << x
end
end
class PersistentArray < Array
= 0.5.12
Mutant configuration:
Matcher: #<Mutant::Matcher::Namespace cache=#<Mutant::Cache> namespace=Yaks>
Strategy: #<Mutant::Rspec::Strategy>
Expect Coverage: 100.000000%
Yaks::Resource::Link#initialize:/home/arne/github/yaks/lib/yaks/resource/link.rb:8
.FFF.....FF
(06/11) 54% - 0.70s
Yaks::Resource::Link#name:/home/arne/github/yaks/lib/yaks/resource/link.rb:12
.FFFF
# There is some interesting magic going on regarding time zones in Rails, even more
# so in Rails 3. The easiest is to talk in UTC to your database and any other service
# you might consume, but we're stuck with a legacy schema that stores Irish time
# without time zone information.
#
# With these settings, ActiveRecord assumes that what is in your DB is in local time,
# and the local time zone is configured to be Dublin, i.e. IST (Irish summer time)
# in summer, UTC (in Ruby still referred to as GMT) in winter.
# When writing to the DB times will first be converted it to Irish time (if it's not already).
# When reading no conversion happens but the time zone is set as being IST/GMT.
# -*- coding: utf-8 -*-
require 'open-uri'
#txt = open('https://raw.githubusercontent.com/openfootball/world-cup/master/2014--brazil/cup.txt').read
txt = open('https://raw.githubusercontent.com/openfootball/world-cup/master/2010--south-africa/cup.txt').read
# (1) Fri Jun/11 16:00 South Africa 1-1 Mexico @ Soccer City, Johannesburg
# (1) Thu Jun/12 17:00 Brazil - Croatia @ Arena de São Paulo, São Paulo (UTC-3)
regex = %r{
# Example: Ruby Enumerator#lazy does not memoize
# A lazy enumerator that displays which elements get realized
x=10.times.lazy.map {|i| print "#{i}." ; i}
# Turns [1,2,3] into [1,[2,[3,[]]]]
def nested(x)
if x.first.nil?
[]
else
# Given an ordered list of elements, how can the possible combinations
# of those elements (of all lengths, order does not matter, no
# repetition) be traversed in the sequence shown below? Either
# iterative or recursive, but it needs to be in such a way that the
# computation of certain branches can be skipped based on a condition
# computed from the combination. E.g. when it reaches [:a, :b], it
# should be possible to say: if check?([:a, :b]) then skip everything
# until [:a, :b, :d] and continue with [:a, :c].
#
# In the concrete problem behind this, the list of elements is a lot
bearings = {
north: ->(x,y) { [x+1, y] },
east: ->(x,y) { [x, y+1] },
south: ->(x,y) { [x-1, y] },
west: ->(x,y) { [x, y-1] }
}
bot = ->(x, y, bearing) do
{
coords: [x, y],
DateNameNetworkPlacepingdown mbpsup mbps
22/11/2013Cafe DaltonBuenos Aires183.040.51
23/11/2013Cam24Buenos Aires521.570.49
25/11/2013Alpina SkateBuenos Aires204.941.15
26/11/2013Recoletta HostelBuenos Aires160.950.25
30/11/2013Alvear HostelSSCCordoba294.043.85
01/12/2013SorocabanaCordoba355.522.92
02/12/2013La MoraCordoba319.781.16
02/12/2013LapanaTendaCordoba544.031.15
08/12/2013Alvear HostelFiberte