Skip to content

Instantly share code, notes, and snippets.

type slowReader struct {
readChan chan int
inReader chan struct{}
id int
}
func (s *slowReader) Read(p []byte) (i int, err error) {
if s.inReader != nil {
s.inReader <- struct{}{}
close(s.inReader)
redbo@saio3:~/gocode/src/github.com/troubling/hummingbird$ sw head proxyserver/test
Content-Length: 23181296
Content-Type: application/octet-stream
Etag: "826fb3a92461d85a30647a9a4ccb2679"
Last-Modified: Fri, 05 May 2017 16:30:34 GMT
X-Object-Meta-Mtime: 1462673034.227554
X-Trans-Id: 14bbc2d17a06718e
redbo@saio3:~/gocode/src/github.com/troubling/hummingbird$ sw get proxyserver/test | wc --bytes
1081344
type ConfigLoader interface {
GetHashPrefixAndSuffixFunc() (string, string, error)
GetPolicies() (conf.PolicyList, error)
GetSyncRealms() (conf.SyncRealmList, error)
GetRing(ringType, prefix, suffix string, policy int) (ring.Ring, error)
}
a = the
c = and
b = be
e = a
d = of
ga = I
gb = keep
fa = have
ia = to
ib = really
#!/bin/bash
set -e
# update and install some necessary system dependencies
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install build-essential memcached rsync xfsprogs git-core libffi-dev python-dev liberasurecode-dev python-virtualenv curl
# set up some directories we'll need to run everything
sudo mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4 /var/run/swift /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4 /var/run/hummingbird /etc/hummingbird /etc/swift
Michaels-MacBook-Pro:~ redbo$ ssh whoami.filippo.io
The authenticity of host 'whoami.filippo.io (178.32.139.168)' can't be established.
RSA key fingerprint is c8:9a:b0:9d:59:96:24:37:70:4c:ef:eb:31:47:68:40.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'whoami.filippo.io,178.32.139.168' (RSA) to the list of known hosts.
+---------------------------------------------------------------------+
| |
| _o/ Hello Michael Barton!
| |
@redbo
redbo / client.py
Last active April 27, 2016 08:37
import pycurl
import cStringIO
c = pycurl.Curl()
c.setopt(pycurl.VERBOSE, 1)
dummydata = "HI THIS IS SOME DATA"
c.setopt(pycurl.URL, "http://127.0.0.1:9000/noreadbody")
package main
import (
"bufio"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httptest"
func DoRequest(req *http.Request, c net.Conn) (*http.Response, error) {
defer req.Body.Close()
dumped, err := httputil.DumpRequestOut(req, false)
if err != nil {
return nil, err
}
if _, err = c.Write(dumped); err != nil {
return nil, err
}
reader := bufio.NewReader(c)
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httptest"