Skip to content

Instantly share code, notes, and snippets.

View artyom's full-sized avatar

Artyom Pervukhin artyom

View GitHub Profile
@artyom
artyom / meminfo.txt
Created December 26, 2018 08:44
memory leak on AWS ec2 a1.large
MemTotal: 3889744 kB
MemFree: 82304 kB
MemAvailable: 18652 kB
Buffers: 32 kB
Cached: 4572 kB
SwapCached: 0 kB
Active: 514320 kB
Inactive: 2472 kB
Active(anon): 512444 kB
Inactive(anon): 224 kB
@artyom
artyom / upload-form.go
Created October 17, 2018 17:37
upload form to see how browser posts files to a form
// TODO describe program
package main
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"strings"
@artyom
artyom / go.mod
Created September 3, 2018 10:57
upload-s3-random-data
module github.com/artyom/upload-s3-random-data
require (
github.com/aws/aws-sdk-go v1.15.6
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20180628210949-0892b62f0d9f // indirect
github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/smartystreets/assertions v0.0.0-20180803164922-886ec427f6b9 // indirect
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect
@artyom
artyom / main.go
Created June 18, 2018 13:26
http server replying with random data of requested size
// TODO describe program
package main
import (
"fmt"
"io"
"math/rand"
"net/http"
"os"
"strconv"
@artyom
artyom / bsdtar-ok.txt
Last active May 17, 2018 16:03
GNU tar bug — tar (GNU tar) 1.30 2017-12-17 06:43
$ for i in {1..3} ; do echo sample $i ; mkdir unpack$i && tar tvf sample$i.tar && bsdtar xf sample$i.tar -C unpack$i && find unpack$i -ls ; done
sample 1
lrwxrwxrwx admin/admin 0 2018-05-17 15:27 foo -> bar
-rw-r--r-- admin/admin 6 2018-05-17 15:27 foo
263199 4 drwxr-xr-x 2 admin admin 4096 May 17 15:48 unpack1
266605 4 -rw-r--r-- 1 admin admin 6 May 17 15:27 unpack1/foo
sample 2
lrwxrwxrwx admin/admin 0 2018-05-17 15:25 foo -> /bar
-rw-r--r-- admin/admin 6 2018-05-17 15:25 foo
266606 4 drwxr-xr-x 2 admin admin 4096 May 17 15:48 unpack2
@artyom
artyom / Gopkg.lock
Last active February 23, 2018 21:38
Illustration that vgo does not (as of 2018-02-23) import "source" attribute from dep metadata
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
name = "github.com/armon/go-socks5"
packages = ["."]
revision = "5ab49e6379c2e1ea5f402e29430ac01f39e60acc"
source = "github.com/artyom/go-socks5"
tlstun (master) ¶ goversion -m $(which tlstun)
/Users/artyom/go/bin/tlstun go1.10
path github.com/artyom/tlstun
mod github.com/artyom/tlstun (devel)
dep github.com/armon/go-socks5 v0.0.0-20171215124554-5ab49e6379c2
=> github.com/artyom/go-socks5 v0.0.0-20171215124554-5ab49e6379c2
dep github.com/artyom/autoflags v1.1.0
dep github.com/artyom/logger v0.0.0-20170228124418-866fc605019a
dep github.com/artyom/ping v0.0.0-20180120203215-e7d66403f7ac
dep github.com/pkg/errors v0.8.0
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
- -------------------------------------------------------------------------
Debian Security Advisory DSA-3999-1 [email protected]
https://www.debian.org/security/ Yves-Alexis Perez
October 16, 2017 https://www.debian.org/security/faq
- -------------------------------------------------------------------------
Package : wpa
@artyom
artyom / listen.go
Last active July 17, 2020 06:29
Listener with SO_REUSEPORT for linux
// +build !linux
package socket
import "net"
func Listen(network, address string) (net.Listener, error) { return net.Listen(network, address) }
recheck ¶ cat naive.py
import re
for i in xrange(0,1000000):
re.match("^[\w-]+:\s", "foo: bar")
recheck ¶ time python naive.py
real 0m1.479s
user 0m1.443s
sys 0m0.020s