Skip to content

Instantly share code, notes, and snippets.

birgersp / retrofit-foreign-key-constraint.sql
Last active March 20, 2024 06:56
Add (change) foreign key constraint to an existing column in PostgreSQL
alter table "Message"
-- drop the old constraint
drop constraint "Message_sender_fkey",
-- (re)add constraint but this time with cascading
add foreign key ("sender") references "Sender"("id") on delete cascade;
birgersp /
Last active April 17, 2024 08:43
Mirror your Github repos
from os import getenv, makedirs, rename
from shutil import rmtree
import subprocess
from dotenv import load_dotenv
import requests
from typing import List
from pathlib import Path
from os.path import join
def get_github_repos(token: str) -> List[str]:
birgersp /
Created January 13, 2024 20:41
rEFInd: set or unset "Microsoft" as default
from argparse import ArgumentParser
from os.path import basename
from pathlib import Path
from typing import List
TARGET_FILE = "/boot/efi/EFI/refind/refind.conf"
TARGET_TEXT = "default_selection Microsoft"
birgersp /
Last active February 6, 2023 12:17
Linux Ubuntu (or Mint) setup
. /etc/upstream-release/lsb-release
# pg admin
curl -fsS | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg --yes
sudo sh -c "echo \"deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] $PGADMIN_URL pgadmin4 main\" > /etc/apt/sources.list.d/pgadmin4.list"
# vs code
apt install schroot
echo \
[jessie] \
description=Raspbian armhf \
directory=/var/chroot \