Skip to content

Instantly share code, notes, and snippets.

View u8sand's full-sized avatar

Daniel J. B. Clarke u8sand

View GitHub Profile

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 May 27, 2026 17:27
A script for reporting number of commits branches are ahead and behind the current branch
#!/bin/bash
if [ "$1" != "" -a "${1:0: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.
@u8sand
u8sand / swagger.yaml
Created April 27, 2022 19:02
A demonstrative swagger.yaml for the Metabolomics Workbench REST API
openapi: 3.0.0
info:
title: Metabolomics Workbench REST API
version: "1.0.0"
description: |
The Metabolomics WorkBench REST service enables access to a variety of data (including metabolite structures, study metadata and experimental results) using HTTP requests. These requests may be carried out using a web browser or may be embedded in 3rd party applications or scripts to enable programmatic access. Most modern programming languages including PHP, Perl, Python, Java and Javascript have the capability to create HTTP request and interact with datasets such as this REST service.
license:
name: Metabolomics Workbench Terms of Use
url: https://www.metabolomicsworkbench.org/about/termsofuse.php
contact:
@u8sand
u8sand / create-hgnc-ttl.py
Last active April 4, 2022 17:01
A turtle file for identifiers.org-prefixed hgnc symbols
import json
import pandas as pd
df = pd.read_csv('https://www.genenames.org/cgi-bin/download/custom?col=gd_hgnc_id&col=gd_app_sym&col=gd_app_name&col=gd_status&col=gd_prev_sym&col=gd_aliases&col=gd_pub_chrom_map&col=gd_pub_acc_ids&col=gd_pub_refseq_ids&col=gd_pub_eg_id&col=gd_pub_ensembl_id&status=Approved&status=Entry%20Withdrawn&hgnc_dbtag=on&order_by=gd_app_sym_sort&format=text&submit=submit', sep='\t')
print('@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .')
print('@prefix gene_symbol: <https://identifiers.org/hgnc.symbol/> .')
print('@prefix semantic: <https://semanticscience.org/resource/> .')
print('')
print('semantic:SIO_001383 rdfs:comment "Gene Symbol"')
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@u8sand
u8sand / get-vaxxed.md
Last active December 5, 2021 23:24
Just a write-up I created in an attempt to convince some people that they should get vaccinated. Obviously from the perspective of a male in their late 20s early 30s

On weighing COVID risks vs vaccination risk

The information in this article should be accurate but comes from external (while reputible) sources. It's possible I made a mistake, in which case i'll be happy for someone to correct it. Given that this write up is not peer reviewed please consider this opinion.

Covid Risks

The COVID Case fatality rate is 2%, ages 20-29 account for the vast majority of covid cases. This rate is higher in older individuals (4x in 30-39, 370x in 85+) (https://www.cdc.gov/coronavirus/2019-ncov/covid-data/investigations-discovery/hospitalization-death-by-age.html)

Estimates think about 1/10 cases are not reported (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7239078/), so overall risk of death by covid living your day to day life is probably 1/10 the case fatality or 0.2%.

@u8sand
u8sand / nginx.tmpl.patch
Created October 29, 2021 19:29
https://kubernetes.github.io/ingress-nginx/ case sensitive route patch /etc/nginx/template/ nginx.tmpl.patch
--- nginx.tmpl.orig 2020-05-12 13:18:43.000000000 -0400
+++ nginx.tmpl 2021-09-21 16:18:40.346643696 -0400
@@ -1015,7 +1015,12 @@
}
{{ end }}
+ # replace case insensitive with case sensitive
+ {{ if hasPrefix $path "~*" }}
+ location ~ {{ slice $path 2 }} {
+ {{ else }}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.