Skip to content

Instantly share code, notes, and snippets.

@christopher-baek
christopher-baek / podman Cheat Sheet
Created November 5, 2023 00:50
podman Cheat Sheet
# podman Cheat Sheet
**create a pod**
```
podman pod create --name=my-pod
```
**create a container in a pod**
@christopher-baek
christopher-baek / Delete System User on Ubuntu
Last active November 5, 2023 01:05
Delete System User on Ubuntu
# Delete System User on Ubuntu
**kill active sessions**
```
sudo loginctl disable-linger [USER]
sudo loginctl terminate-user [USER]
```
**delete user and remove home directory**

Create a pod to hold containers

podman pod create \
  --name YOUR_POD_NAME \
  -p 8080:8080

Create database initialization scripts

After creating a machine and BEFORE starting the machine with the ISO, make the following changes:

cd "C:\Program Files\Oracle\VirtualBox\" 
.\VBoxManage modifyvm "macOS Monterey" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
.\VBoxManage setextradata "macOS Monterey" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac19,1"
.\VBoxManage setextradata "macOS Monterey" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
.\VBoxManage setextradata "macOS Monterey" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Mac-AA95B1DDAB278895"
.\VBoxManage setextradata "macOS Monterey" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
.\VBoxManage setextradata "macOS Monterey" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1

Commands

Run the following at an elevated prompt:

Dism /Online /Cleanup-Image /StartComponentCleanup
Dism /Online /Cleanup-Image /RestoreHealth
SFC /scannow

Create DMG Disk Image

sudo hdiutil create -o /tmp/disk -size 16384m -volname MacOSMonterey -layout SPUD -fs HFS+J

Mount Disk Image

sudo hdiutil attach /tmp/disk.dmg -noverify -mountpoint /tmp/disk
pv FILE.tar.gz | tar -xz

Convert *.iso to *.dmg format

hdiutil will append the "*.dmg" file extension

hdiutil convert -format UDRW -o /path/to/target /path/to/source.iso

Find USB drive

@christopher-baek
christopher-baek / Change Author in Git History.md
Last active February 3, 2022 17:37
Change author in entire Git repo
#!/bin/sh

git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="Christopher Baek"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
 export GIT_COMMITTER_NAME="$CORRECT_NAME"
@christopher-baek
christopher-baek / Algorithms.md
Last active February 3, 2022 17:31
Bloc.io Full Stack Mentor - Candidate Assessment Response

Hey student,

Big O notation is a complex concept to grasp, but ironically, the point of it is actually to try simplify the description of your code! The way I like to think about Big O notation is to think about the number of lines of code that have to be executed with extremely large inputs and to visualize what this actually looks like. This is probably better explained with some examples (look along with this image: https://apelbaum.files.wordpress.com/2011/10/yaacovapelbaumbigoplot_thumb.jpg):

O(1)

def get_value(elements, index):
  return elements[index]

This is O(1) (gray line) because no matter how big the elements array is and no matter what the index value is (assuming it's valid), the time to execute the code will always be the same.