Skip to content

Instantly share code, notes, and snippets.

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
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**
#!/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
#!/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')
@flashvoid
flashvoid / gist:0965307f6f63612e363521c46229bbe6
Last active April 7, 2017 05:07
format hex string using awk
#!/bin/sh
awk '{
split($0, chars, "");
for (i=1; i<=length($0); i++) {
if (flagInLine == 0) { printf ("%-5d", i/32); flagInLine=1 }
printf("%s%s ", chars[i], chars[i+1]);
if ((i+1) % 32 == 0) { flagInLine=0; printf "\n"}
i++
}
server {
listen 443;
server_name localhost;
root html;
index index.html index.htm;
ssl on;
ssl_certificate cert.pem;
ssl_certificate_key cert.key;
(stas-policy)ubuntu@ip-192-168-99-10:~$ sudo mdkir /etc/wicd_sdk^C
(stas-policy)ubuntu@ip-192-168-99-10:~$ sudo su
root@ip-192-168-99-10:/home/ubuntu# mkdir /etc/wicd_sdk
root@ip-192-168-99-10:/home/ubuntu# mkdir /etc/wicd_sdk/output
root@ip-192-168-99-10:/home/ubuntu# chown ubuntu:ubuntu /etc/wicd_sdk/output
root@ip-192-168-99-10:/home/ubuntu# exit
(stas-policy)ubuntu@ip-192-168-99-10:~$ touch /etc/wicd_sdk/output/token1
(stas-policy)ubuntu@ip-192-168-99-10:~$ sudo chmod 400 /etc/wicd_sdk
(stas-policy)ubuntu@ip-192-168-99-10:~$ touch /etc/wicd_sdk/output/token2
touch: cannot touch '/etc/wicd_sdk/output/token2': Permission denied
@flashvoid
flashvoid / data
Last active November 13, 2017 00:13
overlay on gce with vxlan unicast flood
{
"c1": {
"hostname": "netlab-1-0xwl",
"interfaces": {
"vx1" : {
"oip": "192.168.1.2/24",
"vid": 1,
"remotes": [
"10.240.0.8"
]
@flashvoid
flashvoid / data
Last active November 14, 2017 23:51
Take file with column of numbers, in every block of 5 filter out ones larger then token
1
2
3
4
5
6
7
8
12
31
# поднимаем сервер
# nc -l 9090 &
[1] 13126
# ставим дамп
# tcpdump -i any port 9090 -A &
[2] 13130
# tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
# клиент посылает данные серверу