Skip to content

Instantly share code, notes, and snippets.

View chrisjmccrum's full-sized avatar

Christopher McCrum chrisjmccrum

  • 00:50 (UTC -05:00)
View GitHub Profile
@chrisjmccrum
chrisjmccrum / postgres_manager.py
Created April 20, 2024 14:36 — forked from valferon/postgres_manager.py
Python script to take care of postgres backup and restore of data
#!/usr/bin/python3
import argparse
import logging
import subprocess
import os
import tempfile
from tempfile import mkstemp
import configparser
import gzip
@chrisjmccrum
chrisjmccrum / App.md
Created December 27, 2022 04:40 — forked from kcak11/App.md
Country Codes

Country Codes

List of all Country Codes (ISO & Dialing) sorted in alphabetical order.

@chrisjmccrum
chrisjmccrum / cuid.sql
Created November 30, 2022 14:07 — forked from srfrog/cuid.sql
CUIDs for PL/PgSQL
-- Collision-resistant ids optimized for horizontal scaling and performance, for PL/PgSQL.
-- Based on https://github.com/ericelliott/cuid
-- Version 1.0.0
-- Usage: SELECT cuid();
-- BEGIN CONFIG ---
-- Put a unique host ID (int) here per server instance.
-- Once set, this value should not be changed.
English short name lower case Alpha-2 code Alpha-3 code Numeric code ISO 3166-2
Afghanistan AF AFG 004 ISO 3166-2:AF
Åland Islands AX ALA 248 ISO 3166-2:AX
Albania AL ALB 008 ISO 3166-2:AL
Algeria DZ DZA 012 ISO 3166-2:DZ
American Samoa AS ASM 016 ISO 3166-2:AS
Andorra AD AND 020 ISO 3166-2:AD
Angola AO AGO 024 ISO 3166-2:AO
Anguilla AI AIA 660 ISO 3166-2:AI
Antarctica AQ ATA 010 ISO 3166-2:AQ
@chrisjmccrum
chrisjmccrum / DockerFile
Created June 13, 2020 15:24
mssql-server-linux restore bacpac
FROM microsoft/mssql-server-linux:2017-CU9
ENV ACCEPT_EULA=Y
ENV SA_PASSWORD=yourStrong(!)Password
RUN apt-get update && apt-get install unzip -y
# SqlPackage taken from https://github.com/Microsoft/mssql-docker/issues/135#issuecomment-389245587
RUN wget -O sqlpackage.zip https://go.microsoft.com/fwlink/?linkid=873926 \
&& unzip sqlpackage.zip -d /tmp/sqlpackage \
@chrisjmccrum
chrisjmccrum / insomnia.sh
Created December 12, 2018 21:07 — forked from yagop/insomnia.sh
Insomnia REST Client Arch installer
#! /bin/bash
cd $(mktemp -d)
wget https://aur.archlinux.org/cgit/aur.git/snapshot/insomnia.tar.gz
tar xzf insomnia.tar.gz
cd insomnia
makepkg -s
sudo pacman -U insomnia-*-x86_64.pkg.tar
@chrisjmccrum
chrisjmccrum / haproxy.cfg
Created May 9, 2018 18:47 — forked from jclausen/haproxy.cfg
Haproxy - Load Balance All Domains with SSL Termination
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 1024
@chrisjmccrum
chrisjmccrum / AuthenticationHelper.cs
Last active November 14, 2017 17:34
AuthenticationHelper for WebApp Cookie Auth
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using AspNet.Security.OpenIdConnect.Client;
using AspNet.Security.OpenIdConnect.Primitives;
using Microsoft.AspNetCore.Authentication;
@chrisjmccrum
chrisjmccrum / nutjob-webhostbuilder-pattern.cs
Created November 21, 2016 21:08 — forked from guardrex/nutjob-webhostbuilder-pattern.cs
My "NUTJOB" WebHostBuilder Pattern
/*
The purpose of this pattern is to consolidate all application
configuration into just ONE file and configure the app based
on the server/dev environment where it finds itself. It removes
the need for environment variables and/or JSON config files on
individual machines.
*/
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;