Skip to content

Instantly share code, notes, and snippets.

View CodeMan99's full-sized avatar

Cody A. Taylor CodeMan99

View GitHub Profile
@CodeMan99
CodeMan99 / create-pgadmin4.sh
Last active April 6, 2024 16:51
Create pgadmin container for Shuttle cch23
#!/usr/bin/env bash
set -e
CCH23_PORT="${1:?port argument is required}"
NAMESPACE="cch23-codeman99"
LOGIN_EMAIL="codemister99@yahoo.com"
LOGIN_PASSWORD="cch23"
SERVER_JSON_TMP="$(mktemp server-XXX.json)"
@jauderho
jauderho / gist:6b7d42030e264a135450ecc0ba521bd8
Last active July 29, 2024 07:55
HOWTO: Upgrade Raspberry Pi OS from Bullseye to Bookworm
### WARNING: READ CAREFULLY BEFORE ATTEMPTING ###
#
# Officially, this is not recommended. YMMV
# https://www.raspberrypi.com/news/bookworm-the-new-version-of-raspberry-pi-os/
#
# This mostly works if you are on 64bit. You are on your own if you are on 32bit or mixed 64/32bit
#
# Credit to anfractuosity and fgimenezm for figuring out additional details for kernels
#
@CodeMan99
CodeMan99 / devopen.sh
Created February 13, 2023 15:08
Open devcontainer in VSCode (bash function)
function devopen() {
local workspace_folder="$(readlink -f "$1")"
if [ -d "$workspace_folder" ]; then
local wsl_path="$(wslpath -w "$workspace_folder")"
local path_id=$(printf "%s" "$wsl_path" | xxd -ps -c 256)
code --folder-uri "vscode-remote://dev-container%2B${path_id}/workspaces/$(basename "$workspace_folder")"
else
echo "Usage: devopen <directory>" 1>&2
@leandronsp
leandronsp / 001-server.bash
Last active July 18, 2024 08:54
A complete yet simple Web server (with login & logout system) written in Shell Script
#!/bin/bash
## Create the response FIFO
rm -f response
mkfifo response
function handle_GET_home() {
RESPONSE=$(cat home.html | \
sed "s/{{$COOKIE_NAME}}/$COOKIE_VALUE/")
}
@mikejoh
mikejoh / docker-dhcpd.md
Last active July 29, 2024 19:49
Short guide on how to set up a Docker container as a DHCP server

Setting up a Docker container as a DHCP server

In this guide I’ve tested a number of different commands and configurations using Docker to run a container with dhcpd (+macvlan driver) to serve my clients in my home network. In the end i’ll migrate from my Windows 2012 R2 Server running DHCP to a much more lightweight Docker container (7.42 MB in total). Wow.

My home environment:

  • Firewall (Juniper)
    • I’m running IP helper for bootp which in this case means that i relay DHCP requests from various VLANs into one where i've placed my Windows 2012 R2 server. This is also where my container will live. See the FW configuration below:
  1. Sign-up (Join) at the Identus Identity Provider: https://demo-idp.identus.org/ (note: You do not need to use a legitimate email address.)
  2. During this process, you will also be setting up an account at Authorization.io which represents a future browser API and a WebDHT which are currently implemented as a polyfill and a centralized database.
  3. Issue yourself credentials at the Identus Issuer: https://demo-issuer.identus.org/
  4. Utilize your credentials for various purposes at Identus Consumer: https://demo-consumer.identus.org/
Credential Type Consumer Use
Driver's License Open a new bank account
Loyalty Card Purchase winter clothes
Passport Buy an airline ticket
@rduplain
rduplain / linode-node-balancer-500-limitation.md
Last active November 1, 2015 04:20
Linode NodeBalancer: Passive health checks lead to many false positives.

Linode's NodeBalancer assumes (as of Apr 2015) that a 500 response means that the node should be removed from rotation. Naturally, exceptions happen, so this is a very serious design limitation for any application which allows its code to have uncaught exceptions. I have opened a support ticket, with discussion copied here.

Ultimately, we had to rewrite our 500 responses to a non-50x response, which is strange to our application, but at least the change was limited to an nginx config and a single line of JavaScript to handle our status code as a server error. Linode specifically advised to use a non-50x response. All we need is a configuration in the NodeBalancer to not use passive checks on 500 Internal Server Error responses. There is no such configuration.

Due to the head-scratching nature of this configuration, we used 418 I'm a teapot in place of 500 responses. In nginx:

proxy_intercept_errors on;

error_page 500 =418 /_error/internal-serve

@husobee
husobee / .tmux.conf
Created January 30, 2015 19:44
my tmux.conf for weemux
set-option -g status-utf8 on
set -g status-interval 1
set -g status-justify left # center align window list
set -g status-left-length 75
set -g status-right-length 150
set -g status-fg white
set -g status-bg black
set -g status-attr bright
@uranusjr
uranusjr / install_ensurepip.py
Created August 22, 2014 02:44
Script to install ensurepip to Python. “Fix” the Ubuntu 14.04 / Debian Sid bug. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732703
import os
import sys
import io
import tarfile
import urllib.request
ARCHIVE_URL = 'http://d.pr/f/YqS5+'