Skip to content

Instantly share code, notes, and snippets.

View lavie's full-sized avatar

assaf lavie

View GitHub Profile
@lavie
lavie / get_pod_interface.sh
Created July 29, 2019 07:47
how to tcpdump traffic from a specific kubernetes pod
#!/bin/bash -eu
POD_NAME="$1"
IFACE="$(kubectl exec -t "$POD_NAME" -- bash -c "cat /sys/class/net/eth0/iflink")"
echo "Internal interface index: $IFACE. Searching for it on host..."
for i in /sys/class/net/veth*/ifindex; do
if grep "$IFACE" <$i >/dev/null; then
echo -n "Host interface: "
echo "$i" | grep -o -E "veth[^/]*"
@lavie
lavie / aws.json
Created August 25, 2017 05:28
AWS Console Chrome Bookmarks
{
"regions":[
{
"id":"us-east-1",
"name":"US East",
"location":"N. Virginia"
},
{
"id":"us-east-2",
"name":"US East",
@lavie
lavie / lines.md
Last active November 9, 2023 13:53
line continuations in Vim

How do you append line continuation marks to a block of text at a fixed (maximum + 1) column?

e.g. turning this:

some_command argument 
  -o option1
  --some-flag
  -option 2

Into this:

dudde mansa puvve dabme tipve lusfe mikla likdi vetma bibne laste lema lokpa leppi vebpi papne fokta fobmi fedfi sifpi fopsa fespa sopbi baple lunda lufni nokne padbi temvi sampa modpe tamsa momfe bamfa dovta lobde pidvi pomni vobpi bolna kupli sofka sufde fumbi lifta pevne vake kisfi dosmi felfi sotmi tuvli sibna pakdi fasla tabla livle fikpi mipke vavpi peka fodpe sadme lavve nodve mukka musti numde nedle fakmi bikli dudbi samti lodle todba lubmi lofne fitti tadke nifne dindi mivbe timbi dekme kadme fidme fibfe vospe bunli kette setsa nedke laski savpa lodpi pafve modni kepta fanpa nokna suvma kunfa lidma vifki fetsa vumbe dutka kidme temfa mudke pebfa kufti dovte lesla badki kebla tesfa kubli nofve tonba tinta nefta lodti kutfe fame daspi pudsa sitka pevka telda vesla bisi bepbi vefla melpe dodfe totda nipka sopki letpi visbi fula meldi matki felni numsa fevpa tava difa tesfi lilli dopne lebsi fokpa sebli sokda oki nunve futti fomka penve lalpe sodpi siba dodna fovma fapde simde lutsi nibbe talmi lembi pek
$ grep -E '^[a-zA-Z]+$' < words.txt | head -10
a
AA
AAA
AAAA
AAAAAA
AAAL
AAAS
Aaberg
Aachen
@lavie
lavie / old.sh
Last active August 31, 2018 15:30
$ awk '/^[a-zA-Z]+$/{ print tolower($0) }' < words.txt | grep -E 'old$' | head -10
acold
afterhold
ahold
akenbold
anchorhold
ankerhold
anticold
archbold
archibold
$ grep -E 'hold$' < old.txt | head -10
afterhold
ahold
anchorhold
ankerhold
athold
barthold
behold
berthold
bondhold
@lavie
lavie / hodls.sh
Last active August 31, 2018 15:27
$ grep -v '^old$' < old.txt | ./unique.py
bold
cold
cuckold
dippold
fold
forold
frampold
garold
gold
@lavie
lavie / lower.sh
Last active August 31, 2018 15:26
$ awk '/^[a-zA-Z]+$/{ print tolower($0) }' < words.txt | head -10
a
aa
aaa
aaaa
aaaaaa
aaal
aaas
aaberg
aachen
@lavie
lavie / 1.sh
Last active August 31, 2018 15:25
$ head -10 < words.txt
2
1080
&c
10-point
10th
11-point
12-point
16-point
18-point