Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / .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 / Stop and Remove all running docker containers
Created January 15, 2020 15:20
Stop and Remove all running docker containers
for i in $(docker ps | cut -f 1 -d " " | grep -v CONTAINER); do docker stop $i; docker rm $i; done
@mak3r
mak3r / arm-techcon-2019.md
Last active October 8, 2019 04:29
Command line process for demo at Arm TechCon 2019
@mak3r
mak3r / K3os-packer-vagrant-virtualbox.md
Last active January 30, 2023 15:59
Build and run k3os using packer, vagrant and virtualbox

Packer and Vagrant resources to build k3os in VirtualBox

Requirements

  • packer
  • vagrant
  • virtualbox

Build and Run

  1. packer build k3os.json
  2. vagrant up
@mak3r
mak3r / README.md
Last active July 9, 2019 04:22
Find a list of aws instances based on their tag "Name"

Access aws instances easily even after dns name changes

Restarts of aws ec2 instances can cause ips and dns names to change if you don't pay for static IPs

This set of scripts enables quick ssh access to a group of similarly named machines

  1. run generate-instance-list.sh to get a list of aws instance ids
  2. run ssh-connect.sh against the generated list to access any of the instances

TODO

Currently it is not possible to differentiate the machines easily - enable access by more human readable names in the generated instance list.

@mak3r
mak3r / k3s-training.md
Last active April 11, 2022 16:03
Process notes for k3s online training

Prep

  1. Generate a list of instances
  • sbin/generate-instance-list.sh -n mak3r-rancher-training-k3s > instance-ids.json
  • use a script to connect to those instances by list id
    • sbin/ssh-connect.sh -i 0 -k ~/.ssh/mak3r-private.pem -s
  1. Get the cloud server public IP address and replace throughout the script
  2. Prepare a local RPi server