Skip to content

Instantly share code, notes, and snippets.

View ncw's full-sized avatar
💥
429 Too Many Requests

Nick Craig-Wood ncw

💥
429 Too Many Requests
View GitHub Profile
@ncw
ncw / netperf_tcp_crr_reports.markdown
Created May 23, 2011 14:37 — forked from cgbystrom/netperf_tcp_crr_reports.markdown
Reports for netperf's TCP_CRR test

Reports for netperf's TCP_CRR test (i.e TCP accept() performance)

Below is list of results collected with netperf. The interesting value is TCP_CRR, it measures how fast it can TCP connect/request/response/receive. In short, the transaction rate. The test is used to simulate a normal HTTP/1.0 transaction. What's worrying is that this value has very low on Xen virtualized guests. Performance differences between bare metal and virtualization has been as high as 2-3x.

@ncw
ncw / cumul.go
Created July 24, 2012 20:46
Conversion of Cumul.java to Go
// Code from http://lemire.me/blog/archives/2012/07/23/is-cc-worth-it/
// Converted to Go by Nick Craig-Wood
// Runs in pretty much identical time to the "basic sum (C++-like)" code
package main
import (
"fmt"
"time"
)
@ncw
ncw / README.txt
Last active February 20, 2024 19:30 — forked from spikebike/client output
Client side certificates with go
This demonstrates how to make client side certificates with go
First generate the certificates with
./makecert.sh test@test.com
Run the server in one terminal
go run server.go
@ncw
ncw / sort.go
Created March 10, 2015 09:38
A channel based quicksort.
// Channel based quicksort
//
// Just for fun!
//
// Interesting that you can make a quicksort without being able to
// index your input. It may be O(n log n) for comparisons but it is
// O(n) for channels and go routines so perhaps not the most efficient
// quicksort ever ;-)
//
// It also has the worst case complexity O(n²) if you feed it sorted
@ncw
ncw / README.md
Created May 28, 2015 15:00
Go compiler bug demo

Go compiler bug demo

Compiling this directory with go build you get

./e.go:4: TypeType.New undefined (type *Type has no field or method New)

Where if you look in t.go you can see that method is defined.

@ncw
ncw / README.md
Last active March 22, 2016 15:37
Notes on Backblaze B2 API after rclone integration

Notes on Backblaze B2 API after rclone integration

I've finished the first version of rclone integration (see http://rclone.org and http://github.com/ncw/rclone ).

rclone aims to be "rsync for cloud storage" - a command line tool just aimed at the mechanics of transporting files between cloud storage systems and the local disk.

Here are some notes on where I found parts of the API which could be

@ncw
ncw / README.md
Last active March 25, 2016 16:56
Reproduction for OneDrive file corruption

File corruption bug on onedrive

To reproduce, run the python program onedrive_bug.py. This needs the python onedrivesdk. This uploades the file goof.png repeatedly, to the root of your onedrive as 1.png, 2.png, etc.

If you run it after a while you'll see a size mis-match.

This means that the 97k file is apparently 200k. If you look in the web interface it also appears as 200k, however if you download it is

@ncw
ncw / armtogo.pl
Created June 12, 2017 20:56
ARM assembler converter, ARM style to Go style
#!/usr/bin/perl -w
use strict;
# Rough and ready conversion of arm style assembler to go style
# assembler. Note input is expected to be in lower case whereas
# output is in upper case.
while (<>) {
s/ldrb\s+(\w+),\[(\w+),#(\w+)\]/MOVBU\t$3($2),$1/;
s/ldr\s+(\w+),\[(\w+),#([^]]+)\]!/MOVW.W\t$3($2),$1/;
@ncw
ncw / README.md
Created July 21, 2020 20:45
Response to File System Interfaces for Go proposal

This is going to be a long reply based in my experiences with rclone: https://rclone.org. Rclone interfaces with 30ish different cloud providers and has some very similar interfaces so I feel like I might have something to contribute!

As part of rclone I have made very similar interfaces. In fact there are two, one lower level more matched to the typical things cloud storage systems can do (eg read as streams, use Range requests, not seek in writes) and one which is more general purpose which can do everything a normal file system can (eg seek while writing, ReadAt,

module github.com/ncw/go-issue-53253
go 1.18
replace golang.org/x/net => /opt/go/x/net
require (
golang.org/x/net v0.0.0-20220607020251-c690dde0001d // indirect
golang.org/x/text v0.3.6 // indirect
)