Skip to content

Instantly share code, notes, and snippets.

View artyom's full-sized avatar

Artyom Pervukhin artyom

View GitHub Profile
@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 security@debian.org
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
@artyom
artyom / noautosave.patch
Created June 5, 2017 16:07
Patch for https://github.com/Doist/bitmapist-server/ allowing one to disable autmated periodic saving and initiate save by SIGUSR2
diff --git i/bitmapist.go w/bitmapist.go
index 0e22f2c..345ae31 100644
--- i/bitmapist.go
+++ w/bitmapist.go
@@ -18,10 +18,11 @@ import (
func main() {
args := struct {
- Addr string `flag:"addr,address to listen"`
- File string `flag:"db,path to database file"`
~ ¶ cat .bin/org.acme.kill_distnoted.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.acme.kill_distnoted</string>
<key>Program</key>
<string>/Users/artyom/.bin/checkdistnoted</string>
<key>ProgramArguments</key>
@artyom
artyom / ssh-mux.go
Created February 25, 2017 17:26
Example ssh server with both interactive terminal & sftp support
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
@artyom
artyom / bashrc-snippet.bash
Created November 18, 2016 09:47
Show gopher when current working directory is under GOPATH
__pschar () {
IFS=':' read -ra PDIRS <<< "$GOPATH"
for P in "${PDIRS[@]}" ; do
test "${1#$P}" = "$1" || {
printf ""
return
}
done
printf "¶"
}