Skip to content

Instantly share code, notes, and snippets.

View hitorilabs's full-sized avatar
🍵

hitorilabs hitorilabs

🍵
View GitHub Profile
@hitorilabs
hitorilabs / nvidia-tdp.service
Last active September 4, 2023 18:05 — forked from DavidAce/nvidia-tdp.service
NVIDIA Power Limit at Boot
[Unit]
Description=Set NVIDIA power limit above default
[Service]
Type=oneshot
ExecStartPre=/usr/bin/nvidia-smi -pm 1
ExecStart=/usr/bin/nvidia-smi -pl 275
@hitorilabs
hitorilabs / WINDOWS11.md
Last active April 24, 2024 14:53 — forked from hungneox/WIN10.MD
Install Windows 11 From A Bootable USB (macos)

Personally, I prefer installing operating systems from a USB stick, so here's a tutorial

TL;DR

If you already have some idea of what's going on:

  1. Download the ISO from Microsoft - https://www.microsoft.com/en-ca/software-download/windows11
  2. Erase USB device and format in MS-DOS/FAT32
diskutil eraseDisk MS-DOS "WINDOWS11" MBR /dev/diskX
@hitorilabs
hitorilabs / BACKUP_APPLE_PHOTOS.md
Last active September 5, 2023 11:33
Export Apple Photos

Never actually knew where my memes were being saved when I do "Add to Photos", so dropping this script for reference.

I have a 24TB zfs pool to sync everything into, so I'll probably backup and wipe the images every so often.

rsync -avP /Users/<user>/Pictures/Photos\ Library.photoslibrary/originals/**/*.jpeg /path/to/destination

If you follow nvidia's instructions for removing packages, you get stuck in a debugging loop where it says "following packages have unmet dependencies".

For some reason nvidia drivers installed through the default Ubuntu installer is always broken, so you'll need to get force purge these dependencies in order to continue.

sudo dpkg --force-all -P <package_name>

Alternatively, apt --fix-broken install can get you to the point where you can just apt remove all the packages.

If you install windows on a machine that already has ubuntu, it will overwrite the MBR (Master Boot Record).

This is a guide that will allow you to keep boot priority on ubuntu (EFI)

1. re-install grub

grub-install onto the device that you installed ubuntu on (don't specify partition e.g. /dev/nvme0n1)

sudo grub-install /dev/<device_with_ubuntu>
@hitorilabs
hitorilabs / backup.sh
Last active October 14, 2023 15:02
script for backing up a system, I personally ignore home because I don't keep anything important in there - I just clean install when needed. To extract the file, replace `-c` with `-x` and specify the destination (note: this will overwrite existing files)
: ${DESTINATION_DIRECTORY:=} [0/0]
: ${BACKUP_FILENAME:=$(date +%Y%m%d%H%M%S)-backup.tar.gz}
tar -czpvf $DESTINATION_DIRECTORY/$BACKUP_FILENAME \
--exclude=/proc \
--exclude=/tmp \
--exclude=/mnt \
--exclude=/dev \
--exclude=/sys \
--exclude=/run \

ubuntu packages to install fresh

  • sudo apt install rsync tmux git build-essential gcc-12 g++-12
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100
  • from source python + cmake
    • sudo apt install pkg-config libssl-dev

I was wondering why it took so long for my deep learning rig to fully boot up. It literally takes 5 minutes to go from reboot to ssh service start. Unlike desktop motherboards, the ROMED8-2T has two 10G RDMA ethernet controllers and a port for the IPMI interface.

For a while I thought I must have done something wrong - but it turns out when there are free, unmapped ports it will block boot. To fix this, you just need to make the other interfaces optional in your /etc/netplan/*.yaml

network:
  ethernets:
    enoXnpX:
      addresses:
 - ...

WARNING: I don't really care about desktop, so this might fuck it up - make sure you can still ssh into it on reboots

If your installation is really messed up or you've kind of mangled it by mashing commands, you should wipe everything cuda related and restart - the docs provides a neat that will get rid of most if not all traces

(https://gist.github.com/hitorilabs/3fed1a6e5dd500edb5ad7568562c064d)

https://docs.nvidia.com/cuda/cuda-installation-guide-linux/#removing-cuda-toolkit-and-driver

As an overview, here's a laundry list of things you probably want to check:

  • At Installation:

If you are seeing this error, it's likely because you are using an incompatible version of gcc/g++. Currently (2023/11/26), you need to have gcc-12 and g++-12.

gcc: error trying to exec 'cc1plus': execvp: No such file or directory

Make sure to install and point your symlinks for gcc and g++ to the right versions.

sudo apt install gcc-12 g++-12