Skip to content

Instantly share code, notes, and snippets.

View CodeMan99's full-sized avatar

Cody A. Taylor CodeMan99

View GitHub Profile
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@plentz
plentz / nginx.conf
Last active July 30, 2024 09:24
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@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+'
@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
@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

  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
@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:
@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/")
}
@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