Skip to content

Instantly share code, notes, and snippets.

@jkcdarunday
jkcdarunday / switch-audio.sh
Last active April 2, 2024 07:24
A shell script that switches to the next available Pulseaudio/Pipewire Pulse output device/sink
#!/bin/bash
# Author: Jan Keith Darunday <github@jkcdarunday.mozmail.com>
# Description: A shell script that switches to the next available Pulseaudio output device/sink
# Note: This uses pactl instead of pacmd since pacmd is not available in pipewire
function get_current_sink() {
pactl info | sed -En 's/Default Sink: (.*)/\1/p'
}
SINKS=$(pactl list short sinks | grep -v easyeffects)
@hellt
hellt / tkng_prereq_ubuntu20.4.sh
Created December 24, 2020 20:49
tkng lab bootstrap script
#!/bin/bash
#####
#
# This bash script installs latest docker-ce, kubectl and helm software on Ubuntu 20.4 Linux AMD64
#
#####
TMP_DIR="$(mktemp -d)"
########################
@aojea
aojea / README.md
Last active March 2, 2024 13:35
upgrade kind kubernetes cluster
@aojea
aojea / KIND_Networking.md
Last active March 16, 2024 07:27
Use KIND to emulate complex network scenarios

Networking scenarios [Linux Only]

KIND runs Kubernetes cluster in Docker, and leverages Docker networking for all the network features: port mapping, IPv6, containers connectivity, etc.

Docker Networking

KIND uses a docker user defined network.

It creates a bridge named kind

@oofnikj
oofnikj / awsp.bash
Created July 3, 2020 20:15
awsp: AWS profile switcher
### This file is intended to be sourced from ~/.bashrc ###
# quickly switch between AWS profiles with auto-completion
# uses https://github.com/Nike-Inc/gimme-aws-creds to obtain credentials
# if using static credentials, just comment out lines 13-15
awsp() {
if [[ -n $1 ]] ; then
# validate input
grep -q -w "\[profile ${1}\]" ~/.aws/config || { echo "No such profile $1"; return 1; }
@kimbo
kimbo / scrape-doh-providers.py
Last active March 10, 2024 20:49
Scrape DoH provider URLs from cURL's wiki page (see https://raw.githubusercontent.com/wiki/curl/curl/DNS-over-HTTPS)
#!/usr/bin/env python
#
# Scrape Doh provider URLs from Curl's DNS-over-HTTPS wiki (https://raw.githubusercontent.com/wiki/curl/curl/DNS-over-HTTPS).
#
# Example usage: ./scrape_doh_providers.py '"{} - {}".format(o["url"], o["name"])'
#
import argparse
import re
import urllib.request
@LukeSmithxyz
LukeSmithxyz / i3config
Created September 23, 2019 10:43
Final i3 configuration
# vim: filetype=i3
# File originally by Luke Smith <https://lukesmith.xyz>
# This config file will use environmental variables such as $BROWSER and $TERMINAL.
# You can set these variables in ~/.profile or ~/.bash_profile if you have it as below:
#
# export FILE="ranger"
# export TERMINAL="st"
# #---Basic Definitions---# #
@adam-hanna
adam-hanna / TUTORIAL.md
Last active July 20, 2024 12:47
Create and connect macvlan network namespaces

This tutorial was written using Red Hat Fedora 30 but may be similar on other distros.

Discover

You should have an eth0, but if you $ ifconcig -a and don't see it, you should do $ nmcli device status to determine which device is connected to your wifi/ethernet.

Create macvlans and network spaces

$ sudo ip link add macvlan1 link eth0 type macvlan mode bridge
$ sudo ip link add macvlan2 link eth0 type macvlan mode bridge
$ sudo ip netns add net1
@sethwebster
sethwebster / README.md
Last active April 12, 2023 19:06
Make Docker Cache Gem Installs to speed up Bundle Install

Gem Install Dockerfile Hack

If you're hacking on your Gemfile and using Docker, you know the pain of having the bundle install command run after you've added or removed a gem. Using docker-compose you could mount a volume and stage your gems there, but this adds additional complexity and doesn't always really solve the problem.

Enter this imperfect solution:

What if we installed every gem into it's own Docker layer which would be happily cached for us?

gem-inject-docker does just that. It takes the list of gems used by your app via bundle list and transforms it into a list of RUN gem install <your gem> -v <gem version> statements and injects them into the Dockerfile at a point of your choosing.