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
@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")
#!/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
# DOCKER-VERSION 0.6.4

# This is probably only useful if you're setting up a CI environment.

# Adding this line to /etc/default/docker will convince Docker to use btrfs:
# DOCKER_OPTS="--storage-driver=btrfs"

FROM   ubuntu:14.04

RUN echo "deb http://archive.ubuntu.com/ubuntu/ trusty-backports universe" >> /etc/apt/sources.list

@app.route('/<path:path>', methods=['OPTIONS'])
def allow_cors(path):
resp = current_app.make_default_options_response()
resp.headers['Access-Control-Allow-Origin'] = request.headers.get('Origin')
resp.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT'
resp.headers['Access-Control-Max-Age'] = '21600'
resp.headers['Access-Control-Allow-Credentials'] = 'true'
return resp
@redbo
redbo / gist:7592814
Last active December 29, 2015 01:19
package main
import (
"fmt"
"os"
"io"
"encoding/binary"
"encoding/json"
"compress/gzip"
)
gholt Mar 14
Patch Set 1: I would prefer that you didn't submit this
swift/common/middleware/proxy_logging.py:152:9: E301 expected 1 blank line, found 0
This is called proxy_logging in some places, access-logging in others. With where it is
suggested in the pipeline, it seems like access-logging would be the proper name.
However, with this change some requests will be double-logged due to folks writing