Skip to content

Instantly share code, notes, and snippets.

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 (
"bufio"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/http/httptest"
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!
| |
import ctypes
import os
import mmap
class Record(ctypes.Structure):
_fields_ = [('index', ctypes.c_uint64),
('key_length', ctypes.c_uint16),
('key', ctypes.c_char * 256)]
On Wed, Nov 30, 2011 at 4:07 AM, Soren Hansen <soren@linux2go.dk> wrote:
> To me, the PPA's have always been a QA tool. I wanted people willing to
> help test OpenStack to be able to do so with as little effort as
> possible.  Building packages per-commit gave us that.
...
> This is completely different from a "production" PPA. I wouldn't dream
> of pointing people to the above mentioned PPA for their production
> environment.  If someone wants to offer this outside of (but perhaps in
> cooperation with) OpenStack, that'd be great. I'd be delighted to see
> companies taking this on and offering a supported OpenStack
import mmap
import ctypes
class Record(ctypes.Structure):
_fields_ = [('index', ctypes.c_uint64),
('key', ctypes.c_char * 256)]
RECORD_COUNT = 256
#include <stdio.h>
struct args {
int someval;
int someval2;
char *someval3;
};
void _print_some_stuff(struct args a)
{
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
@redbo
redbo / gist:7592814
Last active December 29, 2015 01:19
package main
import (
"fmt"
"os"
"io"
"encoding/binary"
"encoding/json"
"compress/gzip"
)
@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