Skip to content

Instantly share code, notes, and snippets.

@dobe
dobe / build.gradle.kts
Created April 30, 2020 23:12
yarn paths in idea
import org.w3c.dom.NodeList
import javax.xml.parsers.DocumentBuilderFactory
import javax.xml.transform.TransformerFactory
import javax.xml.transform.dom.DOMSource
import javax.xml.transform.stream.StreamResult
import javax.xml.xpath.XPath
plugins {
id("com.github.node-gradle.node") version "2.2.3"
}
@dobe
dobe / i
Last active December 11, 2018 21:39
intellij wrapper around the idea cli script which searches for the project in parent dirs
#!/usr/bin/env bash
set -e
target=${1:-"$PWD"}
target=$(realpath "$target")
if [ -d "$target" ]
then
cd "$target"
@dobe
dobe / gw
Created December 5, 2018 23:11
Gradle Wrapper Caller
#!/usr/bin/env bash
set -e
while [ ! -f gradlew ]
do
cd ..
test $(pwd) = "/" && echo "gradlew not found in current path" && exit 1
done
exec ./gradlew $@
@dobe
dobe / dbg.sh
Created July 3, 2018 13:17
debug http headers on running docker containers
# on the docker host running the container start the netshoot image and connect it to the container
docker run -it --net container:<containerid> nicolaka/netshoot
# example show the http traefik on an interface
tcpdump -i eth1 port 80 -c 1 -Xvv -A
def download(url, filepath):
print "downloading %s to %s" % (url, filepath)
parts = urlparse(url)
login, account, password = netrc.netrc().authenticators(parts.netloc)
request = urllib2.Request(url)
creds = base64.encodestring('%s:%s' % (login, password)).strip()
request.add_header("Authorization", "Basic %s" % creds)
result = urllib2.urlopen(request)
assert result.getcode() == 200
f = open(filepath, 'wb')
@dobe
dobe / kqueue based file mod listener
Created January 23, 2010 08:31
kqueue file watch w python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import select
from select import kqueue, kevent
class Watch(object):
SIZE_HINT = 50000