Skip to content

Instantly share code, notes, and snippets.

@flashvoid
flashvoid / gist:df41829da31162757938
Last active August 29, 2015 14:26
align windows from command line
SIZE=400; STEP=100; for i in `wmctrl -l | awk '/VLC/ { print $1 }'`; do wmctrl -ir $i -e 100,$STEP,100,$SIZE,$SIZE; STEP=$(( $STEP + $SIZE )); done
@flashvoid
flashvoid / gist:7bcc7c7813114e1bd238
Last active October 14, 2015 17:27
linux network namespace routing
ip netns add space-a
ip netns add space-b
ip link add veth0 type veth peer name veth1
ip link set veth1 netns space-a
ip link add veth2 type veth peer name veth3
ip link set veth3 netns space-b
ifconfig veth0 0.0.0.0 up
ifconfig veth2 0.0.0.0 up
ip netns exec space-a ifconfig veth1 192.168.1.130/32 up
ip netns exec space-a route add -host 192.168.7.141 dev veth1
void@tahr:~/docker/etest$ cat Dockerfile
FROM ubuntu
RUN useradd -m user
RUN echo 'export TOKEN=ok' >> /home/user/.bashrc
USER user
void@tahr:~/docker/etest$ docker build -t local/test .
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon
#!/bin/sh
#
make_mac () {
echo "6A:AA:`ifconfig eth0 | head -1 | sed 's/.*HWaddr...:..:\(..:..:..:..\).*/\1/g'`"
}
if ! test -d /dev/net; then
mkdir /dev/net;
mknod /dev/net/tun c 10 200