Skip to content

Instantly share code, notes, and snippets.

View shannonwells's full-sized avatar
🦞
long live Rust

Shannon Wells shannonwells

🦞
long live Rust
View GitHub Profile
@shannonwells
shannonwells / brews.sh
Last active January 12, 2019 00:12
Install script 2: brews.sh - installs all the brew formulas and casks specified in each of 3 files: formulas, casks, fonts.
#!/bin/sh
# Make or touch three files: formulas, casks, and fonts.
# In them, list their respective names of what you want installed.
echo "\033[1;37;45m \033[m"
echo "\033[1;37;45m installing formulas \033[m"
echo "\033[1;37;45m \033[m"
FORMULAS=`cat ./formulas`
@shannonwells
shannonwells / uprepo.sh
Last active January 12, 2019 00:11
Script to do all the updating and whatnot to prepare for rebasing or creating a new git branch -- for a Rails project with yarn
#!/bin/bash
THISDIR="dirname ${BASH_SOURCE}"
echo "Updating your repo."
echo "☕️ Take a break - this might take a few minutes."
git co development -q
git pull origin development --ff-only -q
git fetch --prune -q
bundle install --quiet
yarn install -s
@shannonwells
shannonwells / gup.bash
Last active June 18, 2019 17:20
Go repo helpers
#!/bin/bash
# This is specifically for the go-filecoin repo but a subset of this can apply to any go project with git
# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
set -Euo pipefail
echo "Updating your repo."
echo "☕️ Take a break - this might take a few minutes."
git stash
git co master -q
@shannonwells
shannonwells / pre-commit
Created January 12, 2019 00:15
Pre commit hook for a rails project that uses yarn
#!/bin/sh
RUBOCOP_NAMES='\.(rb|rake)$'
ESLINT_NAMES='\.(es6|jsx|js)$'
PRETTIER_NAMES='\.(es6|jsx|js|scss|json)$'
RUBOCOP_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E $RUBOCOP_NAMES)
ESLINT_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E $ESLINT_NAMES)
PRETTIER_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E $PRETTIER_NAMES)
@shannonwells
shannonwells / __Setup.md
Last active May 9, 2025 17:17
Install scripts for use with a USB key, for setting up a new Mac for development.

Setup files

A semi-generic set of rc files I use for installing a new machine

@shannonwells
shannonwells / reflections_cats_test.go
Last active May 19, 2021 17:27
Reflections in Go, For Cats
package reflect_cats_test
import (
"encoding/json"
"net/url"
"reflect"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@shannonwells
shannonwells / pre-commit
Created July 17, 2020 16:14
pre-commit hook for nodejs projects in Typescript and Javascript.
#!/bin/bash
export JSNAMES='\.(js|ts)$'
export JSNAMES=$(git diff --cached --name-only --diff-filter=ACM | grep -E $JSNAMES)
function exit_err() { echo "❌ 💔" ; exit 1; }
if [[ ! -z $JSNAMES ]]
then
echo "Examining $JSNAMES"
echo $JSNAMES | xargs npm run format || exit_err
@shannonwells
shannonwells / pre-commit
Created July 17, 2020 16:20
pre-commit for a go project
#!/bin/bash
export GO_NAMES='\.(go)$'
export GO_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E $GO_NAMES)
function exit_err() { echo "❌ 💔" ; exit 1; }
if [[ ! -z $GO_FILES ]]
then
echo "Examining $GO_FILES"
echo $GO_FILES | xargs gofmt -s -w || exit_err
@shannonwells
shannonwells / nup.bash
Created July 17, 2020 16:24
A git update script for a nodejs project
#!/bin/bash
# emojis help instantly recognize something went wrong and where
function exit_err() { echo "❌ 💔" ; exit 1; }
set -Euo pipefail
echo "Updating your repo."
echo "☕️ Take a break - this might take a few minutes."
git stash
git co master -q
git pull origin master --ff-only -q
@shannonwells
shannonwells / app.js
Last active August 17, 2020 17:24
Toy websocket client
const express = require('express');
const app = express();
const WebSocket = require("ws");
app.get('/', function (req, res) {
res.send('This is not really a web page.');
});
const port = 3997