View concurrently.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package concurrently | |
import ( | |
"sync" | |
"sync/atomic" | |
) | |
type Task interface { | |
Do() | |
} |
View ssh-reverse-socks5-proxy.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ssh -R 1080 host | |
$ curl -k --socks5 localhost https://not-reachable-from-host | |
$ HTTP_PROXY=socks5://localhost:1080 ./someotherbinary https://not-reachable-from-host |
View go-gdb-attach.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -O runtime-gdb.py https://golang.org/src/runtime/runtime-gdb.py?m=text | |
gdb --pid=11253 | |
source ./runtime-gdb.py | |
info goroutines | |
goroutine 4 bt |
View docker-vpn-setup.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ufw allow 500/udp | |
ufw allow 4500/udp | |
git clone https://github.com/hwdsl2/docker-ipsec-vpn-server.git | |
cd docker-ipsec-vpn-server | |
docker build -t hwdsl2/ipsec-vpn-server . | |
cp vpn.env.example vpn.env | |
# generate psk and password | |
head /dev/urandom | tr -dc A-Za-z0-9 | head -c 13 ; echo '' | |
vim vpn.env | |
docker run \ |
View gomega_transform.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gomegahelpers | |
import ( | |
"github.com/onsi/gomega/types" | |
) | |
func Transform(transform func(oldValue interface{}) interface{}, matcher types.GomegaMatcher) types.GomegaMatcher { | |
return &TransformMatcher{ | |
Transform: transform, | |
Matcher: matcher, |
View pypi_publish.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install twine | |
python setup.py sdist | |
python setup.py bdist_wheel --universal | |
twine upload dist/* |
View patchScalikejdbcStringBinder.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scalikejdbc._ | |
package object models { | |
val stringUTF8: Binders[String] = Binders((rs, index) => new String(rs.getBytes(index), "UTF-8"))((rs, label) => new String(rs.getBytes(label), "UTF-8"))(v => (ps, idx) => ps.setBytes(idx, v.getBytes("UTF-8"))) | |
{ // patch TypeBinder.string | |
val field = TypeBinder.getClass.getDeclaredField("string") | |
field.setAccessible(true) | |
field.set(TypeBinder, stringUTF8) | |
} |
View webdriver.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"chromeOptions": { | |
"prefs": { | |
"credentials_enable_service": false, | |
"profile.password_manager_enabled": false | |
} | |
} | |
} |
View debind.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
for base, dirs, files in os.walk('src/app'): | |
for file in files: | |
path = os.path.join(base, file) | |
if file.endswith('.js') || file.endswith('.jsx') || file.endswith('.ts') || file.endswith('.tsx'): | |
lines = open(path).read().splitlines() |
View zipstream.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
import zipfile | |
import time | |
import os | |
from binascii import crc32 | |
def commonprefix(m): | |
"Given a list of pathnames, returns the longest common leading component" | |
if not m: return '' | |
s1 = min(m) |
NewerOlder