Skip to content

Instantly share code, notes, and snippets.

View snowch's full-sized avatar

Chris Snow snowch

View GitHub Profile
@snowch
snowch / script-template.sh
Created December 18, 2020 08:47 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@snowch
snowch / tmux-sync.sh
Created December 9, 2020 14:13 — forked from kizzx2/tmux-sync.sh
Run multiple commands, and open them all in synchronized tmux panes
#!/bin/sh
#
# The MIT License (MIT)
#
# Copyright (c) 2013 Chris Yuen
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
f().
ClientCertFromKubeconfig = "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJZkY0OFZJcTRFZmN3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TURBek1EVXhPREl6TVRGYUZ3MHlNVEF6TURVeE9ESXpNVFJhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXVJL1c1eTA0NEZPUWlwSlEKclovSjBINW50VmhwbkQ5cUZNaWg0L3kyQVdKMDNBd3NmbU1HbE81d3RnZUNwSGRFZFdzQ05yWDE2N3Y3RUtWVApxUU1MWFBmN1Njd0Z4R1VNUVdaZUZHMTJjc2wzMmxkbEdMc1FtM24vSk5EM1NlZVU5N0Q2cHhMTHRQK2J3UE1wClZkRm8zZG1ER1MwUEtEd3RWY0prdVZNbU1jMFRaY3ovWmN0YUVySVpxUTZqZHdTZWM2NzQ1VDJiOG1nS0JkZ0kKRjhnS2pFQnVCNEFRbzd3OXRuQjhnWjczZUdZb203Q215MGJaYzRRQnBqUWk2V1YzL2tDeExHbW5hSVZDOFRoOQo3VldsTTFZaDB1WDdUbTlrVndwQnZOYVd6UXllTlU5K0RnZmVsRHUzTGdEY2xQM3NZYTB3WWNHci9xUXVDRjVmCkN1QkxoUUlEQVFBQm95Y3dKVEFPQmdOVkhROEJBZjhFQkFNQ0JhQXdFd1lEVlIwbEJBd3dDZ1lJS3dZQkJRVUgKQXdJd0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFDZVBNV0toUERZeTlJQ3ByY2ErblRITFU3MjY5Y0MwNWc3agp
@snowch
snowch / .inputrc
Created June 22, 2020 14:01 — forked from johnlim/.inputrc
Set bash to use Vi-mode and remap <Esc> to jj
# want vi to be the default editor for readline
set editing-mode vi
# vi settings
$if mode=vi
# normal mode
set keymap vi-command
# insert mode
set keymap vi-insert
"jj": vi-movement-mode # remap escape
@snowch
snowch / springer-free-maths-books.md
Created January 13, 2019 12:55 — forked from jnpaulson/springer-free-maths-books.md
Springer have made a bunch of books available for free, here are the direct links

Deploying Elixir and Phoenix applications using Docker and Exrm

Goal

By the end of this quick guide, you will know how to compile a Phoenix app release using Exrm and run it inside a Docker container. I've found only a couple of articles that discuss getting an Elixir app up and running inside a Docker container, and even those only touched on some parts of the process. The idea is that this guide will give you a full end-to-end example of how to get all the pieces and parts working together so that you are able to deploy your Phoenix application inside a Docker container.

Assumptions

  1. You already have a working Elixir environment with the Phoenix Framework installed
  2. You have at least basic working knowledge of Docker, and have installed the Docker tools onto your local environment
@snowch
snowch / GIF-Screencast-OSX.md
Created March 8, 2017 11:48 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@snowch
snowch / GIF-Screencast-OSX.md
Created March 8, 2017 11:48 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@snowch
snowch / ambari-api
Created December 7, 2016 21:04 — forked from glinmac/ambari-api
ambari api examples
#!/bin/sh
AMBARI_USER=admin
AMBARI_PASSWORD=
CLUSTER_NAME=sandbox
AMBARI_API=http://127.0.0.1:8080/api/v1/clusters/$CLUSTER_NAME
BLUEPRINT_API=http://127.0.0.1:8080/api/v1/blueprints
hostname="hostname.example.com"
service="aservice"
@snowch
snowch / lisp.c
Last active August 29, 2015 14:26 — forked from sanxiyn/lisp.c
Lisp
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,