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"
# 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
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 / 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
@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

Keybase proof

I hereby claim:

  • I am dcasati on github.
  • I am dcasati (https://keybase.io/dcasati) on keybase.
  • I have a public key ASCaWwh1ftEBAwbuCHA029qiOLWp-96IWAJtxxhSjeTCrQo

To claim this, I am signing this object:

@dcasati
dcasati / git-squash
Created April 25, 2019 21:12
git squash commit
# Switch to the master branch and make sure you are up to date.
git checkout master
git fetch # this may be necessary (depending on your git config) to receive updates on origin/master
git pull
# Merge the feature branch into the master branch.
git merge feature_branch
# Reset the master branch to origin's state.
git reset origin/master
@dcasati
dcasati / gist:106269802688f4ac76f0326e27222adf
Created January 17, 2021 18:20
executing cilium on a remote pod
# add this to your bashrc
cilium()(kubectl exec -it $(kubectl get pod -l k8s-app=cilium| head -n 2|tail -n 1 | awk '{print $1}') -- cilium $@)
@dcasati
dcasati / renameworkspace.py
Last active May 27, 2021 04:30 — forked from fahrstuhl/renameworkspace.py
Renaming i3 workspaces with https://github.com/acrisci/i3ipc-python while keeping the <number> <letter> prefix for keyboard navigation.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# renameworkspace.py - Renaming i3 workspaces with https://github.com/acrisci/i3ipc-python while keeping the <number>: <letter> prefix for keyboard navigation.
# Written in 2017 by Fahrstuhl
# To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
# You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
import i3ipc