Skip to content

Instantly share code, notes, and snippets.

View hanshasselberg's full-sized avatar

Hans Hasselberg hanshasselberg

View GitHub Profile

https://www.youtube.com/watch?v=Dh86i9HDKck&t=569s

https://www.youtube.com/watch?v=NcpPO9D8jIM

  • oxalic acid vaporization (late november, early december)
@hanshasselberg
hanshasselberg / dnsperf_install.sh
Last active August 18, 2021 09:25
Install dnsperf on ubuntu
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
# 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 '*'

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:

@hanshasselberg
hanshasselberg / gist:5565206
Created May 12, 2013 22:36
Demonstrate file upload with ethon.
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
> 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
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"}
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"}
source "http://rubygems.org"
gem 'typhoeus', :git => "https://github.com/typhoeus/typhoeus.git"
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