Useful Code Snippets
0 4 * * * /usr/bin/docker compose -f /home/garret/prod/docker-compose.yml down
4 4 * * 1 /usr/bin/docker compose -f /home/garret/prod/docker-compose.yml pull
9 4 * * 2-7 /usr/bin/docker compose -f /home/garret/prod/docker-compose.yml up -d
@reboot /usr/bin/docker compose -f /home/garret/prod/docker-compose.yml up -dDocker compose cron sample (user)
6 4 * * 1 /usr/bin/apt-get update -y
11 4 * * 1 /usr/bin/apt-get upgrade -y
16 4 * * 1 /usr/sbin/reboot nowDocker compose cron sample (root)
#backup
sudo dd if=/dev/sda status=progress | bzip2 > /media/disk/image.bz2
#restore
bzcat /media/disk/image.bz2 | sudo dd of=/dev/sda status=progressBackup an entire disk
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 3650 -nodes -subj /C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=CommonNameOrHostname"Create self-signed certificate
adb devices
adb shell
pm list packages | grep demo.app
pm uninstall -k --user 0 com.my.demo.app
----------------------------------------------
adb shell cmd package install-existing com.my.demo.appAndroid remove software
sudo chown -R ec2-user:apache /var/www
sudo chmod 2775 /var/www && find /var/www -type d -exec sudo chmod 2775 {} \;
find /var/www -type f -exec sudo chmod 0664 {} \;
echo "done"
Put proper permissions on web folder
apt-get --print-uris --yes -d --reinstall install -y build-essential > dependencies
sed -i 's/ .*//' "dependencies"
<clean up the file with sed and manual inspection>
wget -i dependencies
sudo apt-get --print-uris --yes -d --reinstall install -y linux-headers-$(uname -r) > headers
sed -i 's/ .*//' "headers"
wget -i headers
dpkg -i *Download all dependancies for a package, debian offline install
{
"psFormat": "table {{.ID}}\\t{{.Image}}\\t{{.Status}}\\t{{.Names}}"
}
Neater docker ps output
docker exec -it <id> psql -U postgres
\l
\dt+ *.*
SELECT * FROM <tablename>;Database snippets
pacstrap -K /mnt base base-devel linux-lts linux-lts-headers linux-firmware vim btop docker docker-compose docker-buildx networkmanager openssh #sbctl #iw #iwd #xfce4 #xfce4-goodies #xorg
dank arch pacstrap
pacman -S --needed xorg xorg-xinit xterm
pacman -S --needed xfce4 mousepad parole ristretto thunar-archive-plugin thunar-media-tags-plugin xfce4-battery-plugin xfce4-datetime-plugin xfce4-mount-plugin xfce4-netload-plugin xfce4-notifyd xfce4-pulseaudio-plugin xfce4-screensaver xfce4-taskmanager xfce4-sensor-plugin xfce4-wavelan-plugin xfce4-weather-plugin xfce4-whiskermenu-plugin xfce4-xkb-plugin file-roller network-manager-applet epdfview galculator lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings capitaine-cursors xdg-user-dirs-gtk alsa-utils pipewire pipewire-alsa pipewire-jack pipewire-pulseOnce setup reaches the language selection screen, press Shift + F10 to open a command prompt. Run the following commands:
reg add HKLM\SYSTEM\Setup\LabConfig
reg add HKLM\SYSTEM\Setup\LabConfig /t REG_DWORD /v BypassTPMCheck /d 1
reg add HKLM\SYSTEM\Setup\LabConfig /t REG_DWORD /v BypassSecureBootCheck /d 1
reg add HKLM\SYSTEM\Setup\LabConfig /t REG_DWORD /v BypassRAMCheck /d 1
reg add HKLM\SYSTEM\Setup\LabConfig /t REG_DWORD /v BypassCPUCheck /d 1
You can now close command prompt and install Windows 11 as normal.
In Command Prompt to bypass network requirements on Windows 11, type the
OOBE\BYPASSNRO
and press Enter.
This script debugs license: https://raw.githubusercontent.com/massgravel/Microsoft-Activation-Scripts/refs/heads/master/MAS/All-In-One-Version-KL/MAS_AIO.cmd
Windows 11 bypass install requirements while in installation screen.
until docker compose pull; do echo "Try again"; doneRepeat a command over and over until it succeeds.