This file contains hidden or 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 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" | |
} |
This file contains hidden or 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
#!/usr/bin/env bash | |
set -e | |
target=${1:-"$PWD"} | |
target=$(realpath "$target") | |
if [ -d "$target" ] | |
then | |
cd "$target" |
This file contains hidden or 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
#!/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 $@ |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
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') |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import select | |
from select import kqueue, kevent | |
class Watch(object): | |
SIZE_HINT = 50000 |