Skip to content

Instantly share code, notes, and snippets.

View jcpst's full-sized avatar
💯

Joseph Post jcpst

💯
View GitHub Profile
@jcpst
jcpst / .bashrc
Last active October 19, 2016 16:01
Basic config for initial msys2 environment
EDITOR='vim'
LS_COLORS='no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:'
PATH=$(
echo "$PATH:/c/Users/joe/bin:/c/Users/joe/AppData/Roaming/nvm:/c/Program Files/nodejs" \
| awk -v RS=':' -v ORS=':' '!a[$1]++{if (NR > 1) printf ORS; printf $a[$1]}'
)
export LS_COLORS
export PATH
@jcpst
jcpst / .eslintrc.json
Created October 4, 2016 14:38
semi-standard without the extra plugins.
{
"env": {
"es6": true,
"node": true
},
"globals": {
"document": false,
"navigator": false,
"window": false
},
@jcpst
jcpst / docker.sh
Created April 6, 2016 01:12
docker scripts
#!/usr/bin/env bash
unalias d
alias d=docker
alias dm=docker-machine
alias fig=docker-compose
alias vidocker="$EDITOR $HOME/.oh-my-zsh/custom/docker.zsh"
de() { docker exec -it $(docker ps -l -q) ${1:-'/bin/bash'}; }
dps() { docker ps --format '{{.ID}}\t{{.Image}}'; }
@jcpst
jcpst / standard-setup.md
Created January 13, 2016 04:24
use standard, less bloat

Install the following devDependencies:

$ npm i -D eslint eslint-config-standard eslint-plugin-standard

config in package.json

"eslintConfig": {
  "extends": "standard",
  "plugins": "standard"
@jcpst
jcpst / golang-template-to-codeship-var.sh
Last active December 10, 2015 18:52
Codeship - Convert golang template from image_tag to environmental variables
echo $1 | sed -e 's/{\.//g' \
-e 's/}}/}/g' \
-e 's/{/\${/g' \
-e 's/\([A-Z]\)/_\1/g' \
-e 's/I_D/ID/' \
-e 's/\${/\${CI/g' \
| tr [a-z] [A-Z]
@jcpst
jcpst / create_key_vars.sh
Last active December 8, 2015 19:23
encrypt docker keys for codeship
#!/bin/bash
## Run in ~/.docker/machine/machines/your-machine-name
## Remove the commas & quotes in the Codeship build, which can be done like so:
## echo -e "$DOCKER_CA_PEM" | tr ',' '\n' | sed 's/"//' | head -c -1 > $HOME/.docker/ca.pem
echo DOCKER_CA_PEM=\"$(cat ca.pem | tr '\n' ',')\" >> deployment.env
echo DOCKER_CERT_PEM=\"$(cat cert.pem | tr '\n' ',')\" >> deployment.env
echo DOCKER_KEY_PEM=\"$(cat key.pem | tr '\n' ',')\" >> deployment.env
echo DOCKER_TLS_VERIFY=1 >> deployment.env
@jcpst
jcpst / gist:e218790978927ab8047d
Created December 3, 2015 20:32
Remove newlines and replace with '\n'
awk -vORS="\\\n" '1' file.txt
@jcpst
jcpst / dm-env.md
Last active December 2, 2015 16:02
Sharing Docker-Machine certs
  1. unzip machine in ~/.docker/machine/machines/
  2. export variables
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://[MACHINE'S IP]"
export DOCKER_CERT_PATH="[FULL HOME PATH]/.docker/machine/machines/khs-eureka3"
export DOCKER_MACHINE_NAME="[MACHINE NAME]"
@jcpst
jcpst / docker.zsh
Last active June 19, 2018 11:45
docker shortcuts - place in ~/.oh-my-zsh/custom
#!/usr/bin/zsh
alias fig=docker-compose
alias dm=docker-machine
dps() { docker ps --format '{{.ID}}\t{{.Image}}'; }
drmc() { docker rm -f $(docker ps -a -q); }
drmi() { docker rmi -f $(docker images -q); }
dstop() { docker stop $(docker ps -a -q); }
@jcpst
jcpst / gist:c7cc936ed4a597869e77
Created October 30, 2015 05:38
ls: list directories and dotfiles first
LC_COLLATE='C' ls -lah --group-directories-first