How to clear ip addr, link
ip link delete vxlan2
ip addr del 192.168.0.55/24 dev vxlan2
VxLAN setup
Machine 1
ip link add vxlan1 type vxlan id 1 remote 192.168.18.48 dstport 4789 dev wlp2s0
ip link set vxlan1 up
ip addr add 192.168.0.6/24 dev vxlan1
Machine 2
ip link add vxlan1 type vxlan id 1 remote 192.168.18.24 dstport 4789 dev wlp3s0\
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
#!/bin/bash | |
set -xe | |
# $0 host dev remote_ip | |
# host is 1 or 2 | |
# on vmA | |
# ./mk-vx.sh 1 ens3 10.10.10.9 | |
# on vmB | |
# ./mk-vx.sh 2 ens3 10.10.10.15 |
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 main | |
import ( | |
"fmt" | |
"os" | |
"os/signal" | |
"syscall" | |
"time" | |
) |
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
# Connect to a WPA2 Enterprise network with wpa_supplicant with this .conf file. | |
# I used this to connect to my university's wireless network on Arch linux. | |
# Here's the command I used: | |
# | |
# wpa_supplicant -i wlan0 -c ./wpa_supplicant.conf | |
# | |
network={ | |
ssid="YOUR_SSID" | |
scan_ssid=1 |
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
sudo modprobe 8021q | |
lsmod | grep 8021q | |
ip link add link eth1 name eth1.10 type vlan id 10 | |
https://dougvitale.wordpress.com/2011/12/21/deprecated-linux-networking-commands-and-their-replacements/ |
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
<?php | |
/** | |
* Calculate the elapsed time between two timestamps | |
* and display in a pretty human way. | |
* @param integer $start Initial timestamp | |
* @param integer $end Final timestamp, set to -1 for current time. | |
* @return string Formatted elapsed time. | |
*/ | |
function timeBetween($start, $end=-1){ | |
if($end < 0) $end = time(); |
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
# Building static nginx for teh lulz | |
# | |
# basic dependencies | |
sudo apt-get install libxslt1-dev libxml2-dev zlib1g-dev libpcre3-dev libbz2-dev libssl-dev | |
# download nginx and openssl | |
wget http://nginx.org/download/nginx-1.5.6.tar.gz | |
tar xf nginx-1.5.6.tar.gz; cd nginx-1.5.6 |
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
<?php | |
function elapsed_time($timestamp, $precision = 2) { | |
$time = time() - $timestamp; | |
$a = array('decade' => 315576000, 'year' => 31557600, 'month' => 2629800, 'week' => 604800, 'day' => 86400, 'hour' => 3600, 'min' => 60, 'sec' => 1); | |
$i = 0; | |
foreach($a as $k => $v) { | |
$$k = floor($time/$v); | |
if ($$k) $i++; | |
$time = $i >= $precision ? 0 : $time - $$k * $v; | |
$s = $$k > 1 ? 's' : ''; |
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
#!/usr/bin/env python | |
import MySQLdb | |
import os, sys | |
import pprint | |
pp = pprint.PrettyPrinter() | |
mysql_host = "localhost" | |
mysql_user = "dbusername" | |
mysql_pass = "dbpassword" |
NewerOlder