Skip to content

Instantly share code, notes, and snippets.

View shwang's full-sized avatar

Steven H. Wang shwang

  • Zürich, Switzerland
View GitHub Profile
#!/bin/sh
for file in *.yml; do
target='/usr/local/etc/rssp/django'
command="sudo diff /home/shwang/eponym/${file} ${target}/${file}"
if `eval "${command} > /dev/null"`; then
echo "${file} is unchanged."
else
echo "${file} has been changed. Here are some raisins:"
eval ${command}
fi
@shwang
shwang / kick.sh
Created November 5, 2015 06:25
kick day-old ssh connections
#!/bin/bash
# kick_idle_ssh.sh
# Hangs up ssh connections that have been idle for over a day.
#
# AUTHOR: shwang 2015.11.4
MAX_IDLE_TIME=86400
function FindProxyForURL(url, host) {
if (dnsDomainIs(host, ".rescomp.berkeley.edu")) {
return "SOCKS5 localhost:50000; DIRECT";
}
if (dnsDomainIs(host, ".housing.berkeley.edu")) {
return "SOCKS5 localhost:50000; DIRECT";
}
quilt@ip-172-31-15-137:~$ swarm logs ip-172-31-10-159/sharp_kalam
16/07/10 18:12:33 INFO Worker: Registered signal handlers for [TERM, HUP, INT]
16/07/10 18:12:34 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
16/07/10 18:12:34 INFO SecurityManager: Changing view acls to: root
16/07/10 18:12:34 INFO SecurityManager: Changing modify acls to: root
16/07/10 18:12:34 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(root); users with modify permissions: Set(root)
16/07/10 18:12:34 INFO Utils: Successfully started service 'sparkWorker' on port 45590.
16/07/10 18:12:34 INFO Worker: Starting Spark worker 10.0.155.142:45590 with 8 cores, 30.4 GB RAM
16/07/10 18:12:34 INFO Worker: Running Spark version 1.6.1
16/07/10 18:12:34 INFO Worker: Spark home: /spark
16/07/10 18:38:10 INFO Worker: Retrying connection to master (attempt # 13)
16/07/10 18:38:10 INFO Worker: Connecting to master spark-ms-0.q:7077...
16/07/10 18:38:13 WARN Worker: Failed to connect to master spark-ms-0.q:7077
java.io.IOException: Failed to connect to spark-ms-0.q/10.0.155.142:7077
at org.apache.spark.network.client.TransportClientFactory.createClient(TransportClientFactory.java:216)
at org.apache.spark.network.client.TransportClientFactory.createClient(TransportClientFactory.java:167)
at org.apache.spark.rpc.netty.NettyRpcEnv.createClient(NettyRpcEnv.scala:200)
at org.apache.spark.rpc.netty.Outbox$$anon$1.call(Outbox.scala:187)
at org.apache.spark.rpc.netty.Outbox$$anon$1.call(Outbox.scala:183)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
@shwang
shwang / gist:f9203b25f67f827881ffdbbe46ca043d
Created July 10, 2016 18:58
etcd 2.3 sparkPI success
ThreadEventExecutor.java:357)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
... 1 more
16/07/10 18:53:15 INFO Worker: Retrying connection to master (attempt # 3)
16/07/10 18:53:15 INFO Worker: Connecting to master spark-ms-0.q:7077...
16/07/10 18:53:15 INFO Worker: Successfully registered with master spark://10.0.52.30:7077
quilt@ip-172-31-7-45:~$ curl http://127.0.0.1:2379/version
{"etcdserver":"2.3.6","etcdcluster":"2.3.0"}
@shwang
shwang / bandwidth_test.out
Created January 3, 2017 05:52
Bandwidth test
client: Container-4{run networkstatic/iperf3 -s, Minion: 172.31.6.44, StitchID: 6, IP: 10.181.0.0, Mac: 02:00:0a:b5:00:00, Labels: [iperf]}
server: Container-5{run networkstatic/iperf3 -s, Minion: 172.31.8.154, StitchID: 3, IP: 10.32.144.0, Mac: 02:00:0a:20:90:00, Labels: [iperf]}
Average bandwidth: 325 Mb/s
client: Container-5{run networkstatic/iperf3 -s, Minion: 172.31.8.154, StitchID: 3, IP: 10.32.144.0, Mac: 02:00:0a:20:90:00, Labels: [iperf]}
server: Container-6{run networkstatic/iperf3 -s, Minion: 172.31.2.222, StitchID: 2, IP: 10.197.48.0, Mac: 02:00:0a:c5:30:00, Labels: [iperf]}
Average bandwidth: 320 Mb/s
client: Container-6{run networkstatic/iperf3 -s, Minion: 172.31.2.222, StitchID: 2, IP: 10.197.48.0, Mac: 02:00:0a:c5:30:00, Labels: [iperf]}
server: Container-12{run networkstatic/iperf3 -s, Minion: 172.31.12.69, StitchID: 4, IP: 10.14.0.1, Mac: 02:00:0a:0e:00:01, Labels: [iperf]}
% go run check_hostnames.go
Container-30{run alpine tail -f /dev/null, Minion: 172.31.11.82, StitchID: 10, IP: 10.232.240.3, Mac: 02:00:0a:e8:f0:03, Labels: [yellow]}
.. OK, 2.yellow.q ==> 10.11.0.2
.. OK, 1.yellow.q ==> 10.11.0.3
.. OK, 2.red.q ==> 10.232.240.4
.. OK, en.wikipedia.org ==> 198.35.26.96
.. OK, 2.blue.q ==> 10.206.32.3
.. OK, red.q ==> 10.0.10.48
.. OK, blue.q ==> 10.0.13.126
.. OK, facebook.com ==> 31.13.77.36
function pdf_join {
join_py="/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py"
read "output_file?Name of output file > "
"$join_py" -o $output_file $@ && open $output_file
}
#!/bin/bash
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get -q update
sudo apt-get install -y python2.7 python3 python3-pip
pip2 install grpcio scapy codecov
pip3 install grpcio scapy-python3 coverage
[[ ${DEBUG:-0} == 0 ]] || sudo apt-get install -y g++-5 # install gcov-5
[[ ${SANITIZE:-0} == 0 ]] || sudo apt-get install -y llvm-3.8
[[ $TAG_SUFFIX != _32 ]] || sudo apt-get install -y lib32gcc1
ln -s /build/dpdk-17.02 deps