Skip to content

Instantly share code, notes, and snippets.

@gnat
gnat / postgres_portable_no_install.md
Last active June 11, 2024 19:39
Postgres Standalone

🐘 Postgres Standalone

Why?

  • Localize your database into one single folder of your choosing.
  • No sudo / root requirement.
  • Run multiple Postgres at the same time on the same machine- Full bare metal performance.
  • Postgres is a great starter before moving to "slow single machine but horizontal scale": CockroachDB, ScyllaDB, etc.

Compile

@abraithwaite
abraithwaite / chill-zoom.sh
Last active May 8, 2024 08:43
Zoom in Systemd Cgroups on Linux. Change the max allocations to fit your workstation.
#!/usr/bin/bash -xe
cat <<EOF > "${HOME}/.config/systemd/user/zoom.slice"
[Slice]
AllowedCPUs=0-4
MemoryHigh=6G
EOF
cat /usr/share/applications/Zoom.desktop | sed -E 's#^(Exec=).*$#Exec=/usr/bin/systemd-run --user --slice=zoom.slice /opt/zoom/ZoomLauncher#' > "${HOME}/.local/share/applications/Zoom.desktop"
@nahun
nahun / README.md
Last active March 25, 2024 18:18
NetBox with AzureAD OAuth

NetBox with AzureAD SSO using OAuth

This is an example setup with NetBox using AzureAD for authentication. It uses the Python Social Auth library.

Most of this was taken from this gist: https://gist.github.com/leoluk/16d91ec22d833945c7ac7ed2b3b05a27

This is written to support NetBox v2.10 to v3.0. I'll try to note differences for 2.9 or earlier.

NOTE: NetBox v3.1 added basic support for using social_auth so most of this is no longer required and can be placed in the configuration.py file.

AzureAD Setup

OCP4 Explicit Manual Upgrades with CLI

In this example, the latest 4.4.x it is 4.4.3 and it has this entry:

Pull From: quay.io/openshift-release-dev/ocp-release@sha256:039a4ef7c128a049ccf916a1d68ce93e8f5494b44d5a75df60c85e9e7191dacc

Validate your current version is in the list of upgrade path for the desired release. For 4.4.3 these are the possible upgrade paths:

Enabling externalIPs on OCP4.2

Edit the config for the network Custom Resource (CR) instance spec.externalIP.policy.allowedCIDRs with the CIDRs to use.

  1. Edit the Cluster network configuration:
oc edit network.config.openshift.io cluster
  1. Edit the spec.externalIP.policy.allowedCIDRs. The following enable 192.168.18.64/26 as an externalIP CIDR:
@MaxXor
MaxXor / btrfs-guide.md
Last active July 15, 2024 08:06
Btrfs guide to set up an LUKS-encrypted btrfs raid volume with included maintenance & recovery guide

Encrypted Btrfs storage setup and maintenance guide

Initial setup with LUKS/dm-crypt

This exemplary initial setup uses two devices /dev/sdb and /dev/sdc but can be applied to any amount of devices by following the steps with additional devices.

Create keyfile:

dd bs=64 count=1 if=/dev/urandom of=/etc/cryptkey iflag=fullblock
chmod 600 /etc/cryptkey
# Assuming that HOSTNAME is enrolled to IPA realm already,
# run the following on HOSTNAME where RADIUS server will be deployed
# In FreeIPA 4.6+ host principal has permissions to create own services
kinit -k
ipa service-add 'radius/HOSTNAME'
# create keytab for radius user
ipa-getkeytab -p 'radius/HOSTNAME' -k /etc/raddb/radius.keytab
chown root:radiusd /etc/raddb/radius.keytab
chmod 640 /etc/raddb/radius.keytab
@leoluk
leoluk / custom_middleware.py
Created January 24, 2019 19:46
Netbox OAuth Login
"""
Custom LOGIN_REQUIRED middleware which allows OAuth URLs.
"""
import utilities.middleware
from django.conf import settings
class CustomLoginRequiredMiddleware(utilities.middleware.LoginRequiredMiddleware):
def __call__(self, request):
@mlalkaka
mlalkaka / ue-roll.sh
Last active October 30, 2022 11:31
Power on and off a UE Roll via Bluetooth using GATT and SPP
#!env sh
mac=C0:28:8D:00:2A:A8
function ue_on() {
handle=0x0003
value=b469218dd9e701
gatttool -b $mac --char-write-req --handle=$handle --value $value
}