Skip to content

Instantly share code, notes, and snippets.

Avatar

Hans Hasselberg i0rek

View GitHub Profile
@i0rek
i0rek / dnsperf_install.sh
Last active Aug 18, 2021
Install dnsperf on ubuntu
View dnsperf_install.sh
sudo apt-get install -y bind9utils libbind-dev libkrb5-dev libssl-dev libcap-dev libxml2-dev
curl ftp://ftp.nominum.com/pub/nominum/dnsperf/2.0.0.0/dnsperf-src-2.0.0.0-1.tar.gz -O
tar xfvz dnsperf-src-2.0.0.0-1.tar.gz
cd dnsperf-src-2.0.0.0-1
./configure
make
sudo make install
View gclone.fish
# accepts git urls git@github.com:etcd-io/etcd.git
# accepts https urls https://github.com/etcd-io/etcd
function gclone
set url $argv
switch $url
case "git*"
set path (string replace -r "\.git\$" "" (string replace ":" "/" (string sub -s 5 $url)))
case "https://*"
set path (string sub -s 9 $url)
case '*'
View keybase.md

Keybase proof

I hereby claim:

  • I am i0rek on github.
  • I am i0rek (https://keybase.io/i0rek) on keybase.
  • I have a public key whose fingerprint is 3A99 65AD CAFC BA51 6057 0F49 3972 102D D7CA BE4D

To claim this, I am signing this object:

@i0rek
i0rek / gist:5565206
Created May 12, 2013
Demonstrate file upload with ethon.
View gist:5565206
require 'ethon'
def forge_easy(url, file)
easy = Ethon::Easy.new(url: url, upload: true)
easy.set_read_callback(file)
easy.infilesize = file.size
easy
end
multi = Ethon::Multi.new
View fu
> require 'typhoeus'
#=> true
> Typhoeus::Config.verbose = true
> Typhoeus.get("www.example.com")
* About to connect() to www.example.com port 80 (#0)
* Trying 2001:500:88:200::10...
* Failed to connect to 2001:500:88:200::10: No route to host
* Undefined error: 0
* Trying 192.0.43.10...
* connected
View gist:4960948
2013-02-15T14:41:21+00:00 app[web.1]: Started POST "/adyen" for 91.212.42.11 at 2013-02-15 14:41:21 +0000
2013-02-15T14:41:21+00:00 app[web.1]: Parameters: {"pspReference"=>"8813609392802715", "eventDate"=>"2013-02-15T14:41:20.17Z", "merchantAccountCode"=>"Wunderlistshop", "reason"=>"73567:1111:6/2016", "originalReference"=>"", "value"=>"5", "eventCode"=>"AUTHORISATION", "merchantReference"=>"SKINTEST-blah", "operations"=>"CANCEL,CAPTURE,REFUND", "success"=>"true", "paymentMethod"=>"mc", "currency"=>"EUR", "live"=>"false"}
View gist:4960931
2013-02-15T14:55:01+00:00 app[web.1]: Started POST "/adyen" for 91.212.42.11 at 2013-02-15 14:55:01 +0000
2013-02-15T15:06:13+00:00 app[web.1]: Parameters: {"pspReference"=>"dispute_report_2013_02_07.csv", "eventDate"=>"2013-02-08T18:39:13.40Z", "merchantAccountCode"=>"Wunderlistshop", "reason"=>"https://ca-test.adyen.com/reports/download/MerchantAccount/Wunderlistshop/dispute_report_2013_02_07.csv", "originalReference"=>"", "value"=>"0", "eventCode"=>"REPORT_AVAILABLE", "merchantReference"=>"", "operations"=>"", "success"=>"true", "paymentMethod"=>"", "currency"=>"EUR", "live"=>"false"}
View Gemfile
source "http://rubygems.org"
gem 'typhoeus', :git => "https://github.com/typhoeus/typhoeus.git"
View gist:4645035
Typhoeus.get("api.travis-ci.org/repos/travis-ci/travis").total_time
#=> 0.428954
Typhoeus.get("https://api.travis-ci.org/repos/travis-ci/travis", followlocation: true).total_time
#=> 0.786656
View gist:4541852
$ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.0.0]
$ irb --version
irb 0.9.6(09/06/30)
$ irb
> a = "gc me"
=> "gc me"
> ObjectSpace.define_finalizer(a, proc {|id| puts "Finalizer one on #{id}" })
=> [0, #<Proc:0x007f9e2abb9200@(irb):3>]
> a = nil