Skip to content

Instantly share code, notes, and snippets.

@JakubOboza
JakubOboza / gist:5780560
Created June 14, 2013 09:14
List Comperhansions
-- ghci example
let infinite_list = [1..n]
take 50 infinite_list
-- works fine and its great :)
let triangles = [(a,b,c) | a <-[1..], b<-[1..], c<-[1..], c^2 == a^2 + b^2]
take 50 triangles
defmodule Hello do
def world do
IO.puts "Hello World"
end
end

replays last FIN-ACK in order to check if the other side correctly implements TIMED-WAIT. other side should be first to close the connection. with http this can be done in curl by forcing http/1.0 mode.

curl -0 -d 'lolol=lololol' http://TARGET/wtwtwt
tcpdump -S 'tcp port 80' -l | ./replayer.rb TARGET 80 YOUR_HOST_AS_APPEARS_IN_TCPDUMP

Example of it working and showing the other side correctly handling TIMED-WAIT:

root@midway:~# tcpdump -S 'tcp port 80' -l | ./replayer.rb 173.194.41.67 80 ip-10-250-157-181.eu-west-1.compute.internal
OMG IM RUNNING

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

@JakubOboza
JakubOboza / Gemfile
Created March 26, 2013 14:48
Gemfile
source 'https://rubygems.org'
gem "activerecord"
gem "httparty"
# Specify your gem's dependencies in mt_sender.gemspec
gemspec
gem "bundler", "~> 1.3"
gem "rake"
Ideas I want to explore for Couchdb development.
1) Protocol Buffers API
2) Enhancing API with a finder doing "first document"
@JakubOboza
JakubOboza / example.jo
Created January 14, 2013 19:34
This is first set of examples of JO programming language designed by me.
add x y = x + y
add 5 6 # -> 11
(add 5 6) # -> 11
map (\x -> x + 1) [2,3,4,5] # -> [3,4,5,6]
loop x =
puts x
@JakubOboza
JakubOboza / fix_yaml.rb
Last active December 10, 2015 21:09
initializer to save the world...
# 2.3
ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING.delete('symbol')
ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING.delete('yaml')
Lt. Gen. Frederick (douchebag) Browning: Only the weather can stop us now.
General Stanislaw Sosaboski: Weather. What of the Germans, General Browning. Don't you think that if we know Arnhem is so critical to their safety that they might know it too?
Lt. General Frederick (douchebag) Browning: See here, General Sosaboski, I should think you would have more faith in Field Marshal Montgomery's plan.
General Stanislaw Sosaboski: Faith? I will tell you how much faith I have. I am thinking of asking for a letter from you stating that I was ordered to go on this mission in case my men are massacred.
Lt. General Frederick (douchebag) Browning: I see... I do see. Do you wish such a letter?
General Stanislaw Sosaboski: No... In the case of massacre: what difference will it make?
def index
@received_messages = current_user.received_messages
@sent_messages = current_user.sent_messages
end
module Presenters
class SitesPieChart
attr_accessor :overall_data, :current_month_data, :objects
def initialize(objects)
self.objects = objects
end
def overall