Skip to content

Instantly share code, notes, and snippets.

View adriantorrie's full-sized avatar

Adrian Torrie adriantorrie

View GitHub Profile
@adriantorrie
adriantorrie / deployment.yml
Created April 15, 2020 11:00 — forked from troyharvey/deployment.yml
Using Kubernetes envFrom for environment variables
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1
@adriantorrie
adriantorrie / apk flags.md
Created January 28, 2020 04:39 — forked from sgreben/apk flags.md
apk flags

apk

apk-tools 2.8.2, compiled for x86_64.

usage: apk COMMAND [-h|--help] [-p|--root DIR] [-X|--repository REPO] [-q|--quiet] [-v|--verbose] [-i|--interactive] [-V|--version] [-f|--force]
           [--force-binary-stdout] [--force-broken-world] [--force-non-repository] [--force-old-apk] [--force-overwrite] [--force-refresh] [-U|--update-cache]
           [--progress] [--progress-fd FD] [--no-progress] [--purge] [--allow-untrusted] [--wait TIME] [--keys-dir KEYSDIR] [--repositories-file REPOFILE]
           [--no-network] [--no-cache] [--cache-dir CACHEDIR] [--arch ARCH] [--print-arch] [ARGS]...
@adriantorrie
adriantorrie / helpful-docker-commands.sh
Created August 15, 2018 03:32 — forked from garystafford/helpful-docker-commands.sh
My list of helpful docker commands
###############################################################################
# Helpful Docker commands and code snippets
###############################################################################
### CONTAINERS ###
docker stop $(docker ps -a -q) #stop ALL containers
docker rm -f $(docker ps -a -q) # remove ALL containers
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter
# exec into container
@adriantorrie
adriantorrie / settings.json
Last active February 22, 2018 13:32
VS Code User Settings
{
"editor.dragAndDrop": true,
"editor.minimap.enabled": true,
// Columns at which to show vertical rulers
"editor.rulers": [
79
],
# Hive Makefile
# -----------------------------------------------------------------------------
# The @ in front of the commands prevents make from printing the command
# $<: The file thats changed
# $@: The target file to be created from changed file
# $(@D): The directory part of the target file name ($@)
#
# List of make commands:
# make SAFE Default build command for development
# make clean SAFE Blows away bin folder
@adriantorrie
adriantorrie / sed cheatsheet
Created February 12, 2018 00:56 — forked from un33k/sed cheatsheet
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@adriantorrie
adriantorrie / remove-docker-containers-images.sh
Created January 25, 2018 02:02
Delete docker containers and images
#!/bin/bash
# Delete all stopped containers
docker ps -q -f status=exited | xargs --no-run-if-empty docker rm
# Delete all dangling (unused) images
docker images -q -f dangling=true | xargs --no-run-if-empty docker rmi
@adriantorrie
adriantorrie / initialise_pyspark_environment.bat
Created December 1, 2017 04:07
Windows - Setup pyspark into an anaconda environment
@echo off
if not defined in_subprocess (cmd /k set in_subprocess=y ^& %0 %*) & exit )
:: setup control vars
set "this_dir=%~dp0"
set "temp_file=%TEMP%\sparkmagic_location.txt"
set /p initiative_number=Enter initiative number:
set "env_name=i_%initiative_number%"
ECHO.
@adriantorrie
adriantorrie / .bashrc
Last active September 4, 2022 15:04
.bashrc for Windows
# pyenv discovery
export PATH="/c/Users/adria/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
# allow Python to be called from Git Bash after activating conda env,
# along with any arguments to the python call
python() {
winpty "$(which python)" "${@}"
}
@adriantorrie
adriantorrie / plot_distributions.py
Last active August 29, 2017 01:46
Plot distributions of each series in a Pandas dataframe
# plot the distribution of each feature
def plot_distributions(df, cols=3, width=20, height=20, hspace=0.45, wspace=0.5):
# generate the figure to draw on
plt.style.use('seaborn-whitegrid')
fig = plt.figure(figsize=(width, height))
fig.subplots_adjust(left=None, bottom=None, right=None, top=None,
wspace=wspace, hspace=hspace)
rows = math.ceil(float(df.shape[1]) / cols)
# add subplot for each series with appropriate formatting