Skip to content

Instantly share code, notes, and snippets.

View optix2000's full-sized avatar

Weilu Jia optix2000

View GitHub Profile
@optix2000
optix2000 / Golang cancellable sleep benchmark results
Created August 8, 2021 20:57
Golang cancellable sleep benchmarks
% go test -bench=.
goos: linux
goarch: amd64
pkg: test
cpu: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
BenchmarkCancelContext-8 345220 3498 ns/op 192 B/op 4 allocs/op
BenchmarkCancelAfter-8 765330 2659 ns/op 328 B/op 5 allocs/op
BenchmarkTimeoutContext-8 142429 9855 ns/op 480 B/op 7 allocs/op
BenchmarkTimeoutAfter-8 61796 19571 ns/op 376 B/op 6 allocs/op
PASS
@optix2000
optix2000 / go_test.go
Last active April 13, 2020 06:03
goroutine vs channel vs single threading performance
package main
import "testing"
var channel = make(chan []byte, 1024)
var data = make([]byte, 1024)
var sink = []byte{}
func goroutine(data []byte) {
sink = data
@optix2000
optix2000 / gist:9778eb615677d7cfedba674c94c04136
Created January 21, 2018 09:26
Scaleway 3 Euro shootout (ARM64-2GB vs VC1S)
Scaleway 4 core ARM64 vs 2 core x86_64
========================================================================
BYTE UNIX Benchmarks (Version 5.1.3)
System: scw-e8880b: GNU/Linux
OS: GNU/Linux -- 4.14.14-mainline-rev1 -- #1 SMP Wed Jan 17 14:31:53 UTC 2018
Machine: aarch64 (aarch64)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
07:57:21 up 4 min, 1 user, load average: 0.23, 0.13, 0.05; runlevel 2018-01-21
@optix2000
optix2000 / not_rspec_steps_spec.rb
Last active July 18, 2017 02:54
Hacky rspec-steps for smoke tests
require 'capybara'
require 'capybara/rspec'
require 'capybara/poltergeist'
require 'capybara-screenshot/rspec'
Capybara.configure do |c|
c.javascript_driver = :poltergeist
c.run_server = false
c.app_host = 'http://app.lvh.me:3000'
end
From 5b47a47153e0e1beb6f1ae94b50faad7de1c8244 Mon Sep 17 00:00:00 2001
From: Tobias Brunner <tobias@strongswan.org>
Date: Fri, 21 Aug 2015 17:25:00 +0200
Subject: [PATCH] child-sa: Add an option to install outbound trap policies
only
When enabled this prevents the installation of IN/FWD policies for
auto=route connections. So unencrypted/unauthenticated inbound traffic
won't be blocked but it might be useful in some scenarios.
@optix2000
optix2000 / dbtest
Created August 7, 2016 05:39
mariadb 10.0 vs postgres 9.4
root@hammer-512mb-sfo1-01:~/sysbench-0.4.12/sysbench# ./sysbench --test=oltp --db-driver=pgsql run
sysbench 0.4.12: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 1
Doing OLTP test.
Running mixed OLTP test
Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
Using "BEGIN" for starting transactions
@optix2000
optix2000 / svp
Last active August 7, 2016 05:39
SVP
SetMemoryMax(1024) # Legacy from AviSynth days. To stop AviSynth from hemorrhaging memory.
AddAutoloadDir("C:\Program Files (x86)\AviSynth+\plugins+") # Cuz I didn't actually install AviSynth
SetFilterMTMode("DEFAULT_MT_MODE", 1) # Default mode 1. Apparently it now plays nice with SVP
SetFilterMTMode("ffdshow_source", 3) # Source has to be mode 3
ffdshow_source() # Source
super=SVSuper("{gpu:1}") # Use GPU
# Small 32x32 blocks (for 1080p) with additional refine to 4x4. no penalty for zero vectors (trying to get rid of artifacts with text on screen)
vectors=SVAnalyse(super,"
{
block:{w:32, h:32, overlap:2},