Skip to content

Instantly share code, notes, and snippets.

@mak3r
mak3r / .tmux.conf
Created January 22, 2020 14:49
tmux configuration file
setw -g mode-keys vi
bind-key @ command-prompt -p "create pane from:" "join-pane -s ':%%'"
@mak3r
mak3r / get-ubuntu-18.04-ami.sh
Created January 23, 2020 13:36
Get the AMI for ubuntu bionic 18.04
#!/bin/sh
# based on this https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html#finding-an-ami-aws-cli
aws ec2 describe-images --owners 099720109477 --filters 'Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-????????' 'Name=state,Values=available' --query 'reverse(sort_by(Images, &CreationDate))[:1].ImageId' --output text
@mak3r
mak3r / retain-history.sh
Last active January 24, 2020 02:18
Capture the command history before moving between projects
#!/bin/sh
#run this in all open terminals
history -a
# run this in the terminal where history (raw and sorted) is being captured
history -a; history -c; history -r
# capture the history to a file
# because sometimes order of operations matters
@mak3r
mak3r / rpi-disable-swap.md
Last active February 12, 2020 14:48
Disable the swap on a raspberry pi

Disable swap - works on raspbian buster

sudo systemctl disable dphys-swapfile.service

Disable swap - fedora 30

sudo systemctl disable zram-swap.service

@mak3r
mak3r / runlike
Created March 18, 2020 16:46
get the full command used to run a docker container
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
assaflavie/runlike <container>
@mak3r
mak3r / delete-line.sh
Created March 25, 2020 18:33
delete a single line of a file - super useful when ssh complains about re-issued keys in known_hosts
#!/bin/sh
file=$1
line=$2
sed -i.bak -e "$2d" "$1"
@mak3r
mak3r / rancher-cluster.sh
Last active May 14, 2021 21:55
Create rancher clusters using the custom model or import an existing cluster.
#!/bin/bash
shopt -s expand_aliases
alias echo='echo -e'
# fake server-url
RANCHER_SERVER=https://your_rancher_server.com
ROLEFLAGS=""
CLUSTER_CREATE_TYPE=
DOCKER="DOCKER"
@mak3r
mak3r / mp-hello.json
Last active October 29, 2021 15:04
Matrix Portal Messages
{ "text": "Hello" }
@mak3r
mak3r / arm64-base-config
Created December 7, 2021 16:43
Testing RancherOS2 builds on currently unsupported aarch64 architecture
#cloud-config
rancheros:
install:
# An http://, https://, or tftp:// URL to load as the base configuration
# for this configuration. This configuration can include any install
# directives or OEM configuration. The resulting merged configuration
# will be read by the installer and all content of the merged config will
# be stored in /oem/99_custom.yaml in the created image.
# configURL: http://example.com/machine-cloud-config
# Turn on verbose logging for the installation process
@mak3r
mak3r / legacy-mac-brew.sh
Last active March 29, 2022 21:58
List any brew installed software that is still using x86 architecture
#!/bin/bash
for i in $(brew list --formula); do which $i | xargs file | grep x86 ; done
for i in $(brew list --cask); do which $i | xargs file | grep x86 ; done