Skip to content

Instantly share code, notes, and snippets.

View coopbri's full-sized avatar
⛰️
Deep diving

Brian Cooper coopbri

⛰️
Deep diving
View GitHub Profile
@coopbri
coopbri / wg0-client.conf
Last active February 13, 2020 19:41
Wireguard server and client template with iptables rules (peer-to-peer connection with one client)
/etc/wireguard/wg0-client.conf
--------------------------------------------------------------
[Interface]
Address = ($client-ipv4)/32
PrivateKey = $(client-privkey)
[Peer]
PublicKey = $(server-pubkey)
Endpoint = $(external-address):51820
@coopbri
coopbri / venv.sh
Created April 27, 2020 04:19
Create a Python virtual environment with `virtualenv`
#!/bin/sh
# Create a Python virtual environment with `virtualenv`
#
# Other options exist for creating and managing virtual environments, such as:
# Conda: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
# Pipenv: https://pipenv.pypa.io/en/latest/
virtualenv venv/ # Create virtual environment -- `venv` can be anything you'd like
source venv/bin/activate # Activate virtual environment in session (change `venv` according to your selection in above command)
@coopbri
coopbri / wsl2_arch_linux.md
Last active August 22, 2020 04:43
Convert an existing WSL1 Arch Linux to WSL2

Converting Arch Linux on WSL 1 to WSL 2

Currently (and probably in the future), the official Microsoft documentation for upgrading from WSL1 to WSL 2 does not suggest Arch Linux as a distribution. This may be due to the fact that it was removed from the Windows Store. However, it is still possible to use Arch Linux on WSL 2. The steps for converting Arch Linux from WSL 1 to WSL 2 are outlined below.

Prerequisite Version Check

  • Make sure Windows 10 version 2004, build 19041 or higher is installed. This can be verified by executing winver in the Run dialog (Meta + R).

Install WSL 2

  1. Install the Windows Subsystem for Linux optional feature:
PowerShell (Admin)
@coopbri
coopbri / raspi_unattended.md
Last active April 26, 2024 13:17
Automatically update packages on Raspberry Pi OS (most recent version checked: August 2020)
  1. Install unattended-upgrades package:

     # apt install unattended-upgrades
  2. Add Raspberry Pi Foundation sources to unattended-upgrades config:

     # /etc/apt/apt.conf.d/50unattended-upgrades
     
    

Unattended-Upgrade::Origins-Pattern {

@coopbri
coopbri / prisma_aliases.sh
Last active September 13, 2020 19:08
Prisma Aliases
# Aliases for Prisma: https://www.prisma.io/
alias prisma="npx prisma"
alias mg="migrate"
alias pmgs="npx prisma migrate save --experimental"
alias pmgu="npx prisma migrate up --experimental"
alias pgen="npx prisma generate"
import com.onesignal.OSNotification;
import com.onesignal.OSMutableNotification;
import com.onesignal.OSNotificationReceivedEvent;
import com.onesignal.OneSignal.OSRemoteNotificationReceivedHandler;
/**
* Notification service extension. Handles receiving of notifications in destroyed lifecycle state.
*/
public class NotificationServiceExtension implements OSRemoteNotificationReceivedHandler {
/**
@coopbri
coopbri / force-delete-namespace.sh
Last active July 27, 2021 17:18
Forcefully delete a Kubernetes namespace
#!/bin/sh
# Forcefully delete a Kubernetes namespace.
if [[ $# -eq 0 ]]; then
echo $'[ERROR] No namespace specified, please specify one \n\n Usage: ./force-delete-namespace.sh [namespace]'
exit 0
fi
# get namespace JSON
kubectl get ns $1 -o json >tmp_$1.json
@coopbri
coopbri / build-ue5-linux.md
Last active March 1, 2024 07:28
Build Unreal Engine 5 on Linux
  1. Clone repo (or sync with git pull if already cloned):
git clone https://github.com/EpicGames/UnrealEngine
  1. Run setup script:
./Setup.sh
@coopbri
coopbri / arch-nvidia-beta-dkms.md
Created June 7, 2022 08:51
Arch Linux NVIDIA beta DKMS drivers
  1. Build nvidia-beta-dkms and nvidia-utils-beta, (Check ~/.cache/yay/... for cached packages)
  2. Install packages together with yay -U [nvidia-beta-dkms location] [nvidia-utils-beta location], e.g. yay -U ~/.cache/yay/nvidia-beta-dkms/nvidia-beta-dkms-[...].pkg.tar.zst ~/.cache/yay/nvidia-utils-beta/nvidia-utils-beta-[...].pkg.tar.zst
@coopbri
coopbri / carbon-arch-install.md
Created August 10, 2022 16:38
Install Carbon language on Arch Linux

⚠️ Note that these instructions may not be entirely correct, as Carbon is under heavy development. I will try to keep this up to date, but please let me know if you find any errors or improvement opportunities. See here for generic Linux installation instructions.

In particular, I was unable to build Carbon using extra/clang and aur/bazelisk, and had to shim similar packages with brew.

  1. Install build tools
 # sync key required for `libunwind-carbon`
gpg --recv-keys 015A268A17D55FA4