Skip to content

Instantly share code, notes, and snippets.

View braynm's full-sized avatar

Bry braynm

View GitHub Profile
@braynm
braynm / setup_tailwind_in_phoenix.md
Created May 17, 2020 09:37 — forked from josephan/setup_tailwind_in_phoenix.md
Add Tailwind CSS to an Elixir/Phoenix Project with PurgeCSS
@braynm
braynm / csv2json.sh
Created April 25, 2020 04:12 — forked from DecisionNerd/csv2json.sh
CSV to JSON converter using BASH. Original script from http://blog.secaserver.com/2013/12/convert-csv-json-bash/
#!/bin/bash
# CSV to JSON converter using BASH
# original script from http://blog.secaserver.com/2013/12/convert-csv-json-bash/
# thanks SecaGuy!
# Usage ./csv2json.sh input.csv > output.json
input=$1
[ -z $1 ] && echo "No CSV input file specified" && exit 1
[ ! -e $input ] && echo "Unable to locate $1" && exit 1
@braynm
braynm / Flexible Dockerized Phoenix Deployments.md
Created April 6, 2020 14:39 — forked from jswny/Flexible Dockerized Phoenix Deployments.md
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

@braynm
braynm / ._reactFormatting
Created February 16, 2020 12:46 — forked from iannbing/._reactFormatting
A gist for initial eslint and prettier setup for React projects
We couldn’t find that file to show.
@braynm
braynm / copy from|to csv.sql
Last active October 18, 2021 07:04
copy from|to csv in postgresql
-- Save without header
copy ((select "name", "email from "user") to '/absolute-path-to-directory/filename.csv' delimiter ',' csv;
-- Save with header
copy ((select "name", "email from "user") to '/absolute-path-to-directory/filename.csv' delimiter ',' csv header;
-- When having issue `must be superuser or a member of pg_write_server_files role COPY to a file`, add a `\` in front of `copy`
\copy ((select "name", "email from "user") to '/absolute-path-to-directory/filename.csv' delimiter ',' csv;
@braynm
braynm / init.vim
Created August 1, 2019 23:32
nvim
""" Optixal's Neovim Init.vim
""" Vim-Plug
call plug#begin()
" Aesthetics - Main
Plug 'dracula/vim', { 'commit': '147f389f4275cec4ef43ebc25e2011c57b45cc00' }
Plug 'junegunn/goyo.vim'
Plug 'junegunn/vim-journal'
Plug 'junegunn/rainbow_parentheses.vim'
@braynm
braynm / restore.sh
Created June 4, 2019 02:05
postgres backup, import db.
# backup db
psql reforecast < prod.sql
# restore db
@braynm
braynm / .eslintrc.js
Last active March 20, 2019 06:59
standard lint rules for nodejs/backend development
module.exports = {
"env": {
"node": true,
"es6": true
},
"globals": {
"request": true,
"app": true,
"expect": true,
"describe": true,
@braynm
braynm / .vimrc
Last active March 18, 2019 08:19
vim .vimrc configuration
syntax enable
set tabstop=2
set number
set expandtab
set softtabstop=2
set shiftwidth=2
set cursorline
set showmatch
set autoindent
set smartindent
Download a single file from a remote ftp server to your machine:
sftp username@hostname:remoteFileName localFileName
Upload a single file from your machine to a remote ftp server:
sftp {user}@{host}:{remote_dir} <<< $'put {local_file_path}'