Skip to content

Instantly share code, notes, and snippets.

Avatar

Jakob Borg calmh

View GitHub Profile
@calmh
calmh / versions.txt
Created May 14, 2020
Syncthing versions
View versions.txt
syncthing v0.7.2 (go1.2.1 freebsd-amd64)
syncthing v0.7.3 (go1.2.1 freebsd-amd64)
syncthing v0.8.0 (go1.2.1 freebsd-amd64)
syncthing v0.8.1 (go1.2.1 freebsd-amd64) jb@jborg-mbp 2014-04-19T20:37:11Z
syncthing v0.8.2 (go1.2.1 freebsd-amd64) jb@jborg-mbp 2014-04-27T06:35:23Z
syncthing v0.8.3 (go1.2.1 freebsd-amd64) jb@jborg-mbp 2014-05-02T18:20:06Z
syncthing v0.8.4 (go1.2.1 freebsd-amd64) jb@jborg-mbp 2014-05-04T06:18:20Z
syncthing v0.8.5 (go1.2.2 freebsd-amd64) jb@jborg-mbp 2014-05-11T18:46:09Z
syncthing v0.8.7 (go1.2.2 freebsd-amd64) jb@jborg-mbp 2014-05-16 14:28:52 UTC
syncthing v0.8.8 (go1.2.2 freebsd-amd64) jb@jborg-mbp 2014-05-21 13:37:28 UTC
@calmh
calmh / rwlisten.go
Last active Jun 12, 2018
Toy HTTP-over-stdio thing
View rwlisten.go
package main
import (
"fmt"
"io"
"net"
"net/http"
"os"
"time"
)
View gist:5ba12fdf06da21edac0d72f76f97081c
jb@unu:~/t/build $ VERBOSE=1 make
/usr/local/Cellar/cmake/3.8.2/bin/cmake -H/Users/jb/tmp/tray/subdirs/syncthingtray -B/Users/jb/tmp/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.8.2/bin/cmake -E cmake_progress_start /Users/jb/tmp/build/CMakeFiles /Users/jb/tmp/build/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f c++utilities/CMakeFiles/c++utilities.dir/build.make c++utilities/CMakeFiles/c++utilities.dir/depend
cd /Users/jb/tmp/build && /usr/local/Cellar/cmake/3.8.2/bin/cmake -E cmake_depends "Unix Makefiles" /Users/jb/tmp/tray/subdirs/syncthingtray /Users/jb/tmp/tray/c++utilities /Users/jb/tmp/build /Users/jb/tmp/build/c++utilities /Users/jb/tmp/build/c++utilities/CMakeFiles/c++utilities.dir/DependInfo.cmake --color=
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f c++utilities/CMakeFiles/c++utilities.dir/build.make c++utilities/CMakeFiles/c++u
View android.md

Starting from an Ubuntu installation or similar Docker image, install the NDK.

curl -s -o /tmp/android-ndk.zip https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip
cd /usr/local
unzip /tmp/android-ndk.zip
rm -f /tmp/android-ndk.zip

Create the standalone stuff, whatever that is. Arm and arm64.

View flatten_test.go
package flatten
import (
"reflect"
"testing"
)
// This implements a flatten function for arbitrarily nested integer lists.
// I've chosen Go as the implementation language as it's the one I'm most
// comfortable in right now, but in a way this problem is a bad fit for the
View -
func TestTimeoutCond(t *testing.T) {
const (
// Low values to avoid being intrusive in continous testing. Can be
// increased significantly for stress testing.
iterations = 100
routines = 10
timeMult = 2
)
View main.go
package main
import "golang.org/x/time/rate"
func main() {
r := rate.NewLimiter(0, 100)
if r.Allow() {
panic("should not allow")
}
}
View -
jb@unu:~/s/g/c/j/timetest $ go run main.go
true
true
true
true
true
true
true
true
true
View sendhex.py
#!/usr/bin/env python
import sys
import socket
hex = ""
for line in sys.stdin.readlines():
first_space = line.index(' ')
if first_space > 2:
line = line[first_space:]
View sendhex.go
package main
import (
"bufio"
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"net"