Skip to content

Instantly share code, notes, and snippets.

Avatar
💥
429 Too Many Requests

Nick Craig-Wood ncw

💥
429 Too Many Requests
View GitHub Profile
@ncw
ncw / README.md
Created Jul 21, 2020
Response to File System Interfaces for Go proposal
View README.md

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,

@ncw
ncw / armtogo.pl
Created Jun 12, 2017
ARM assembler converter, ARM style to Go style
View armtogo.pl
#!/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
Last active Mar 25, 2016
Reproduction for OneDrive file corruption
View README.md

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 / README.md
Last active Mar 22, 2016
Notes on Backblaze B2 API after rclone integration
View README.md

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
Created May 28, 2015
Go compiler bug demo
View README.md

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 / sort.go
Created Mar 10, 2015
A channel based quicksort.
View sort.go
// 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.txt
Last active Dec 6, 2021 — forked from spikebike/client output
Client side certificates with go
View README.txt
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 / cumul.go
Created Jul 24, 2012
Conversion of Cumul.java to Go
View cumul.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"
)
View netperf_tcp_crr_reports.markdown

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.