Skip to content

Instantly share code, notes, and snippets.

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

Anne Isabelle "Anya" Macedo retpolanne

🏳️‍⚧️
View GitHub Profile
#/usr/bin/env bash
function _completions() {
COMPREPLY+=("-e")
COMPREPLY+=("--echo")
COMPREPLY+=("--some-flag")
COMPREPLY+=("-c")
COMPREPLY+=("--non-interactive")
COMPREPLY+=("--")
}

Installing Ubuntu on your Mac... isn't really so hard.

I spent the whole day trying to dual-boot Ubuntu on my Mac, up to the point where I broke my GPT partition table and almost had to format everything (see [https://gist.github.com/vinicyusmacedo/4172cafc108bdfff7084017d1925b74f]). Then, I just found out installing Ubuntu on a Mac is really really easy. You need no gimmick at all (I'm not sure if I've just been lucky enough).

I won't cover anything in detail, but you need to, basically:

  1. Resize your APFS container (quite easy to do and non destructive) and keep some free space for Ubuntu
  2. Create an installation drive (follow the official guides)
  3. Install Ubuntu!

How to save your life if you f%$@d your Mac's GPT table and save your files!

I was messing around with running Ubuntu on my Mac and trying very hard to make GRUB boot without rEFInd. I just gave up and decided to somehow delete the old volumes created by Ubuntu. As I did it, the UUID of my volume became all FFFFs! FFFF%$#, I said to myself. Fearing for the worse, I rebooted the computer to see if that really harmed something. It did: there was no boot disk!

before trying anything here, investigate a bit further what is going on in your own environment, Your Mileage May Vary

I'm using a Macbook Air 2014 11", 500GB SSD, using APFS, running on Mojave (though the recovery image was from Yosemite).

Make sure you are pointing to the correct disk (mine was disk0, but you need to check with diskutil).

@retpolanne
retpolanne / ps3-linux.md
Created March 20, 2020 01:02
Linux Notes

These are some notes regarding PS3 Linux (how to boot it)

  • You need Rebug/Rebug Toolbox for that
  • You need the dtbImage file on a USB drive (plugged on the right-most USB port). Resize VNAND, Install petitboot.
  • According to this doc
   dtbImage.%:		Similar to zImage, except device tree blob is embedded
			inside the image instead of provided by firmware.  The
			output image file can be either an elf file or a flat
@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)
"
@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
" 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'

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

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

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