Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
period=$1
shift
pattern=$@
last_timestamp=
while :; do
line=$(dmesg | grep "$pattern" | tail -n 1)
timestamp=$(echo $line | cut -d" " -f1 | sed 's/[]\[]//g')
#!/bin/bash
ip2dec () {
local a b c d ip=$@
IFS=. read -r a b c d <<< "$ip"
printf '%d\n' "$((a * 256 ** 3 + b * 256 ** 2 + c * 256 + d))"
}
die () {
echo $1
Adding datacenter
syntax: `vipsmart dc add dc-1,192.168.0.99,9610`
Tells **local dc** to add **candidate dc** dc-1 to the federation.
If **local dc** is not federated yet it will decalre federation consisting
of itself and add **candidate dc**.
Important assumptions:
- **local dc** might not be federated yet, it will create a federation of itself and add **candidate dc**
root@kimogi-MacBookAir:/home/kimogi# ifconfig eth0 # original mac
eth0 Link encap:Ethernet HWaddr bc:f6:85:d7:1a:1a
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
root@kimogi-MacBookAir:/home/kimogi# ifconfig eth0 down
root@kimogi-MacBookAir:/home/kimogi# ifconfig eth0 hw ether de:ad:be:ef:00:00
#!/bin/bash -ex
replace_template_entries() {
MAP=$1
REPLACEMENT_TAG=$2
ACTION=$3
TOOLCHAIN_DOCKERFILE="/tmp/testsetup"
package main
import (
"fmt"
"encoding/json"
"math/big"
"os"
)
type dc struct {
{
"Caterpie": [1.04, 1.08],
"Weedle": [1.06, 1.1],
"Abra": [1.36, 1.95],
"Gloom": [1.48, 1.53],
"Oddish": [1.48, 1.51],
"Ponyta": [1.48, 1.5],
"Bellsprout": [1.54, 1.6],
"Bulbasaur": [1.53, 1.58],
"Weepinbell": [1.47, 1.59],
Example policy for traffic fro pod to host
```
{
"rules": [
{
"ports": [
80
],
"protocol": "TCP"
}
./romana segment add tenantname segmentname. --externalid <externalid>
./romana tenant add <tenantname> --externalid <externalid>
#!/usr/bin/env python
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
from optparse import OptionParser
from urlparse import urlparse, parse_qs
import os
parser = OptionParser(usage="%prog --port")
parser.add_option('--port', default=8080, dest="port", type="int",
help="Port number to listen for incoming requests")