Skip to content

Instantly share code, notes, and snippets.

View dcasati's full-sized avatar

Diego Casati dcasati

View GitHub Profile

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 / dakboard-pi
Created April 15, 2019 16:17
Dakboard Install on Raspberry Pi
# from https://www.raspberrypi.org/magpi/dakboard-wall-display/
# before proceeding, open the Raspberry Pi SD Card (mount that on Linux/Mac) and add the following:
#
# 1. enable ssh
# a) create an empty file called `ssh`.
# 2. enable wifi
# a) create a filled called `wpa_supplicant.conf` with a content similar to this.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
@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 / vcxsrv config
Created December 1, 2020 17:34
Running i3wm on WSL2 with two monitors (dual head)
C:\Program Files\VcXsrv>vcxsrv.exe -screen 0 @2 -wgl -nodecoration +xinerama -screen 1 @3 -wgl -nodecoration +xinerama -ac
then add this to your ~/.config/i3/config file:
fake-outputs 1920x1200+0+0,1920x1200+1920+0
@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
@dcasati
dcasati / batch remove azure service principals
Last active January 11, 2022 22:38
batch remove Service Principals not being used
az_rm_sp()(az ad sp list --show-mine -o json --query "[?contains(displayName, '$1')]" | jq -r '.[] | .appId' | xargs -P 4 -n 12 -I % az ad sp delete --id %)
example:
az_rm_sp azure-cli
# Use these steps to clear out Github's commit history.
# Useful when moving a repo from private to public
git checkout --orphan newBranch
git add -A # Add all files and commit them
git commit
git branch -D main # Deletes the main branch
git branch -m main # Rename the current branch to main
git push -f origin main # Force push master branch to github
git gc --aggressive --prune=all # remove the old files
tested on Fedora release 34 (Thirty Four):
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
echo -e "[azure-cli]
name=Azure CLI
baseurl=https://packages.microsoft.com/yumrepos/azure-cli
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/azure-cli.repo"
#remove the azure cli if installed via apt:
sudo apt remove azure-cli
#install the azure cli with pip:
sudo python3 -m pip install msrest==0.6.21
sudo python3 -m pip install azure.cli