Skip to content

Instantly share code, notes, and snippets.

View retpolanne's full-sized avatar
🏳️‍⚧️

Anne Isabelle "Anya" Macedo retpolanne

🏳️‍⚧️
View GitHub Profile
@retpolanne
retpolanne / bash.sh
Last active May 11, 2019 22:04
Some useful bash commands
# Making substitutions on files where a certain pattern is found
fgrep -r "<something>" . | awk -F : '{print $1}' | xargs sed -i "s/<something>/<something else>/g" $@
## Mac OS specifics
## Cleaning up Time Machine snapshots
tmutil listlocalsnapshots / | awk -F "." '{print $4}' | while read dt; do tmutil deletelocalsnapshots $dt; done
@retpolanne
retpolanne / teresa-dev-env.md
Last active September 24, 2019 22:07
This gist shows how to create a dev environment of Teresa using minikube (not suitable for production)

My Teresa dev environment

Defaults:

  • mysql user: teresa
  • mysql password: foobar
  • mysql database: teresa
  • mysql namespace: mysql
  • mysql helm name: mysql
  • mysql service name: teresa

Kubernetes the hard way - notes

Gcloud

Creating a project and linking billing

# Create project
gcloud projects create project-name --set-as-default
# List billing accounts

Debugging techniques

TCPDUMP

tcpdump -i eth0 -s 1024 -A

Shows only packets from eth0, size of packet is 1024, -A prints ascii.

TCPDUMP and Docker for Mac

MicroK8s

Installing and configuring MicroK8s

# You can find other channels at https://microk8s.io/docs/release-channels
snap install microk8s --classic --channel=1.14/stable

# use this to check microk8s status
microk8s.status

Mounting LUKS root disk on Ubuntu 19.04 (if your current root disk is also encrypted)

I had some trouble mounting a LUKS device recently, so I decided to make this gist.

So, it looks like Ubuntu already does the job of doing luksopen on your device, so you don't have to worry about it.

In order to mount it, I had to:

  1. Find the VG UUID of my drive with vgdisplay
  2. Rename it to something else with vgrename
" vim airline required configs
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" add plugins bellow
Plugin 'stephpy/vim-yaml'
@retpolanne
retpolanne / spinup-gocd.md
Last active April 16, 2021 04:43
Spin up GoCD on Kubernetes
  • kubectl create ns gocd
  • helm repo add stable https://kubernetes-charts.storage.googleapis.com
  • helm install gocd-app --namespace gocd stable/gocd
  • Get the ingress IP and hit it
  • Get the ca and the token generated from the service account
secret_name=$(kubectl get serviceaccount gocd-app --namespace=gocd  -o jsonpath="{.secrets[0].name}")
kubectl get secret $secret_name --namespace=gocd -o jsonpath="{.data['token']}" | base64 --decode
kubectl get secret $secret_name --namespace=gocd  -o jsonpath="{.data['ca\.crt']}" | base64 --decode
@retpolanne
retpolanne / slack-afk.sh
Last active December 30, 2020 17:09
Slack script that changes your status to AFK or Working Remotely
#!/bin/bash
usage="$(basename "$0") [OPTIONS] -- changes your Slack status to AFK or Working Remotely
[OPTIONS]:
-h|--help This help message
--afk Changes your Slack profile to AFK
--remote Changes your Slack profile to Working Remotely
--token Your Slack token (see https://api.slack.com/legacy/custom-integrations/legacy-tokens)
"