Skip to content

Instantly share code, notes, and snippets.

View u8sand's full-sized avatar

Daniel J. B. Clarke u8sand

View GitHub Profile
@u8sand
u8sand / !case-sensitive-ingress-nginx.md
Last active January 30, 2023 19:32
This patches the ingress-nginx controller to use case sensitive path prefix matching

case-sensitive-ingress-nginx

This patches the ingress-nginx controller to use case sensitive path prefix matching.

My issue in the repo was ignored

@u8sand
u8sand / df2pg.py
Last active March 24, 2025 14:18
A micro-library for quick pandas dataframe => postgres upload
'''
This snippet can be used for quickly copying a pandas dataframe
into postgres via unix pipe. I expect this to be faster than other
approaches since the writing can happen entirely in native code:
- os.pipe is facilitated by the kernel
- psycopg2 copy_from uses libpg
- np.savetxt uses libnumpy
Usage:
@u8sand
u8sand / !neo4j-ex.md
Last active November 15, 2022 21:34
A more convenient neo4j container which allows you to import dumps inplace

NEO4J Extended Docker Container

This overrides public neo4j container on dockerhub to make it more convenient to override the operating database at runtime.

To that effect it:

  • uses supervisord configured with supervisorctl support to maintain the neo4j process
  • it defines a script: neo4j-load which can import dumps from network endpoints

Usage

#!/bin/python3
# python archs4-dl.py series-samples GSE53655 | python archs4-dl.py fetch > GSE53655.tsv
import re
import json
import click
import urllib.request, urllib.parse, urllib.error
from tqdm import tqdm
@u8sand
u8sand / ssh-crypt.sh
Created September 1, 2022 21:29
Use ssh keys & github for quick and easy crypto.
#!/bin/bash
#
# A helper for using ssh keys & github for encrypting/decrypting messages intended for specific recipients.
# Installation (assumes ~/.local/sbin/ is in your PATH, put it wherever you want):
# 1. Download script
# 2. mv ssh-crypt.sh ~/.local/sbin/ssh-crypt
# 3. chmod +x ~/.local/sbin/ssh-crypt
#
# See `ssh-crypt help` for command information.
@u8sand
u8sand / rclone-serve-combined
Last active August 6, 2022 15:52
A simple script for serving one store with all rclone remotes as directories. I use this as a daemon which can be accessed with dolphin :)
#!/bin/bash
# `rclone serve -h` for other remotes / arguments
PROTOCOL="webdav"
ARGS="--vfs-cache-mode writes"
# we construct an inline combined upstream with all remotes using the remote name as the directory
rclone listremotes \
| awk -F':' -v ARGS="${ARGS}" -v PROTOCOL="${PROTOCOL}" "
BEGIN {

SSH Through TLS Terminating Ingress

AKA ssh over ssl
AKA ssh over tls
AKA ssh over https

Background

Some firewalls are annoying and don't just block ports that aren't 443, they also block packets that aren't TLS/SSL. Fortunately there is of course a way around this, and that is to wrap the ssh communication in TLS.

@u8sand
u8sand / git-ahead-behind
Last active January 24, 2024 19:04
A script for reporting number of commits branches are ahead and behind the current branch
#!/bin/sh
if [ "$1" != "" ]; then
CURRENT_BRANCH=$1
shift
else
CURRENT_BRANCH=$(git branch --show-current)
fi
git branch $@ | awk -v CURRENT_BRANCH=$CURRENT_BRANCH '
@u8sand
u8sand / neo4dump.py
Last active July 12, 2022 00:20
Quick and dirty neo4j database dump when all else fails
import json
import click
import logging
from pathlib import Path
from py2neo import Graph
@click.command(help='''
Quick and dirty neo4j database dump when all else fails. The format is:
nodes.jsonl: {
@u8sand
u8sand / link-ck.py
Last active April 28, 2022 14:52
Link-CK finds dead links recursively in text documents and tests them.