Skip to content

Instantly share code, notes, and snippets.

View dcasati's full-sized avatar

Diego Casati dcasati

View GitHub Profile
@dcasati
dcasati / dmenu_ssh
Created October 26, 2013 21:01
ssh keybind via dmenu
#!/bin/sh
# a simplified version based on ideas from
# https://opensource.conformal.com/fluxbb/viewtopic.php?id=473
# you need to bind this program to a proper shortcut on your wm
# for instance on i3 I use the following:
# bindsym $mod+k exec /usr/local/bin/dmenu_ssh
SSH_TO=`awk '/^Host/{print $2}' $HOME/.ssh/config | dmenu`
XTERM_OPTS="-bg black -fg grey +sb"
@dcasati
dcasati / kube-dns-port-forward.sh
Last active October 21, 2024 19:46
kubernetes - Kube-DNS port forwarding and DNS querying.
# Use dig to find out about the k8s records
# dig +vc -p 5300 @127.0.0.1 cluser.local
# Use dig to retrieve an A Record
# dig +vc -p 5300 @127.0.0.1 A cb-example-0000.default.svc.cluster.local
# Use dig to do a reverse lookup (-x flag)
#dig +vc -p 5300 @127.0.0.1 -x 10.0.50.156
# Add the port forward
# On Ubuntu, you need to add the following line to your synergy.service file:
# 1. Edit the sudo vi /lib/systemd/system/synergy.service
[Service]
Environment=DISPLAY=:1
# 2. reload systemd and the synergy service
sudo systemctl daemon-reload
sudo restart synergy
@dcasati
dcasati / run-previous-az-cli-version
Created January 11, 2018 18:24
run a previous version of the az cli
docker run -v ${HOME}:/root -it azuresdk/azure-cli-python:2.0.23
@dcasati
dcasati / export-kubeconfig-from-aks
Created February 6, 2018 15:30
Export KUBECONFIG from AKS
az aks get-credentials --resource-group k8s-demo-ss --name k8s-demo-cluster-ss --file kubeconfig-ss
@dcasati
dcasati / freebsd-bluetooth-mouse.txt
Created July 5, 2018 21:00
Configure FreeBSD Bluetooth Mouse
Add to /boot/loader.conf:
ng_ubt_load="YES"
Add to /etc/rc.conf:
hcsecd_enable="YES"
sdpd_enable="YES"
bthidd_enable="YES"
Reboot, or run:
@dcasati
dcasati / gist:f116827c425c4d2849f7ebd5477c1452
Last active March 5, 2019 22:44
i3wm on a multi-monitor setup (laptop + external display)
xrandr --output HDMI1 --scale 2x2 --mode 1920x1200 --fb 3840x4200 --pos 0x0
xrandr --output eDP1 --scale 1x1 --pos 320x2400
1. Create an user on the cisco device
username dcasati privilege 15 secret MYbiGsecrRETThatOnlyIknoW
2. Convert your pub key to less than 254 characters (otherwise it will not work)
$ fold -b -w 72 ~/.ssh/id_rsa.pub
3. Create the key
conf t
ip ssh pubkey-chain
@dcasati
dcasati / tcpdump-kubernetes
Created March 6, 2019 19:54
visualize a tcpdump capture from a Kubernetes POD on Wireshark in real time
run tcpdump on a POD and then (live) see that information through wireshark locally on my machine. the magic of ssh and fifo 
Topology
--------
[laptop with wireshark] ------> [AKS Node] ----> [POD (tcpdump is here)]. 
1. create the fifo on your local machine (where wireshark will run)
mkfifo /tmp/remote-capture.fifo
2. execute the following command to send traffic from within a POD to the stdout. This will then be redirected to the fifo locally
@dcasati
dcasati / requirements.txt
Created March 7, 2019 00:04 — forked from zoni/requirements.txt
Example Python WSGI app which displays the hostname of the system it runs on when accessing /hostname
flask