Skip to content

Instantly share code, notes, and snippets.

@bencoullie
Last active November 14, 2021 22:08
Show Gist options
  • Save bencoullie/811303ff6c647f98c0c1180f35b401e7 to your computer and use it in GitHub Desktop.
Save bencoullie/811303ff6c647f98c0c1180f35b401e7 to your computer and use it in GitHub Desktop.
Doohikkies
# # # # # # # # # # #
# Personal aliases: #
# # # # # # # # # # #
# Everyday
# Speak the truth
alias saga="say 'Why not use a saga'"
# Git aliases
alias g='git'
alias gpom="git pull origin master"
alias gpo="git pull origin"
alias gcb="git checkout -b"
alias gcm="git checkout master"
alias gcmp="git checkout master && git pull"
alias gdifs="git diff --staged --color | diff-so-fancy"
alias gopen="git open"
alias gr="git recent"
alias gc="git checkout"
alias gbn="git branch | grep '^\*' | cut -d' ' -f2 | pbcopy"
alias gsu="git status -u"
alias gsi="echo '🤦 You hit GSI again dude...' && git status -u"
alias gb="git branch"
alias gbd="git branch -d"
alias gsui="git submodule update --init"
alias grhh="git reset HEAD --hard"
alias bdif="git diff origin/master --name-only | awk -F '/' '/^(bower_components)\// {print $2}' | sort | uniq"
# show latest git stash dif
alias gstsp="git stash show -p"
alias ga="git add"
alias gap="git add -p"
alias gp="git push"
alias gpull="git pull"
alias gf="git fetch"
alias gm="git merge"
alias gl="git log --oneline"
alias gcam="git commit --amend -m"
alias gca="git commit -a"
alias gcfdx="git clean -fdx"
# Refresh aliases and push/set upstream branch to current branch name
alias gpuo="git push -u origin"
alias gpuop="git push -u origin gcpp"
# C/O master, pull latest, checkout previous branch then merge master
alias gmm="git checkout master && git pull origin master && git checkout - && git merge master"
# C/O feature, update local to latest then merge previous branch
alias gmiaws="git checkout corporate-feature-aws && git reset origin/corporate-feature-aws --hard && git merge -"
# Add all untracked files
alias gau="echo -e "a\n*\nq\n"|git add -i"
# Remove all merged branches (except master and feature)
alias gprune='git branch --merged | egrep -v "(^\*|master|corporate-feature-aws)" | xargs git branch -d'
alias gcom="git commit -m"
# Get all local branches from latest to oldest
alias gbl="git for-each-ref --count=10 --sort=-committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) (%(color:green)%(committerdate:relative)%(color:reset))'"
# TODO not sure if these work
gitstash() {
git stash push -m "zsh_stash_name_$1"
}
gitstashapply() {
git stash apply $(git stash list | grep "zsh_stash_name_$1" | cut -d: -f1)
}
alias gst="git stash"
alias gsts="git stash save"
alias gstl="git stash list"
alias gstp="git stash pop"
alias gsta="git stash apply"
alias gstd="git stash drop"
alias gstiu="git stash --include-untracked"
# Commit with a message (no quatation marks required)
gcii () {
git commit -m "$@"
}
# C/O master and delete previous branch
# NOTE: WIP
gcmgbdp () {
export BRANCH=$(git rev-parse --abbrev-ref HEAD)
git checkout master && git branch -d $BRANCH
}
# Check the git diff of all unstaged files (no param) or particular unstaged file (file path as param)
gdif () {
if [ $# -eq 0 ]; then
git diff --color | diff-so-fancy
else
git log -p -1 --color "$@" | diff-so-fancy
fi
}
# GO aliases
alias gr="go run main.go"
gob () {
go build && ./${PWD##*/}
}
# alias grpe="go build -mod=vendor && SOURCE_PROGRAM=crayola LOG_LEVEL=debug TAIL_BACKEND=redis TAIL_REDIS_PRODUCT_EXPORT_DB=1 KNIGHT_ENDPOINT_URL="duke" PRODUCT_EXPORT_PROCESSORS=1 PRODUCT_EXPORT_PREPROCESSORS=1 PRODUCT_EXPORT_NOTIFICATORS=0 ./crayola -mode worker-product-export"
# General aliases
alias oyomd="psql -h localhost -p 5432 -U Ben oneyearonemedia"
alias c="clear"
# Update current terminal with new aliases
alias bfresh=". ~/.bash_aliases"
# Nuke NPM and bower and reinstall all
# Then, if you need to, do this `gulp` || `gulp build`
alias refe="nvm use && rm -rf ./node_modules && rm -rf ./bower_components && yarn && binstall"
# Edit bash_aliases file with vscode
alias cbash="code ~/.bash_aliases"
# Edit bash_aliases file with nano
alias nbash="nano ~/.bash_aliases"
# Nuke node modules and reinstall
alias nukenode="rm -rf node_modules/ && npm install"
# Nuke node and bower and reinstall
alias rip="rm -rf node_modules && rm-rf bower_components && yarn run setup"
# Install a global node package (example: npm i -g phantomjs)
alias npmig="npm i -g"
# Coloring for ls
alias ls='ls -GFh'
# Use a long listing format
alias ll='ls -la'
# Show hidden files
alias l.='ls -d .*'
# Open a folder with php storm (add . to open cur_dir)
alias phpstorm='open -a PhpStorm'
# Grep with color
alias grep='grep -n --color'
# Grep all files and folders
# i stands for ignore case (optional in your case).
# R stands for recursive.
# l stands for "show the file name, not the result itself".
# n stands for "show line numbers"
# / stands for starting at the root of your machine.
alias grepril='grep -Riln --color'
# Grep bash_aliases
cgba () {
if [ "$#" -eq 1 ]; then
grep -n --color "$1" ~/.bash_aliases
else
grep -n -B "$2" -A "$2" --color "$1" ~/.bash_aliases
fi
}
# Test a particular php unit test
phput () {
./lib/vendor/phpunit/phpunit/phpunit test/phpunit/unit/Service/"$1"
}
# Docker aliases
alias dstopa="docker stop $(docker ps -a -q)"
alias dc="docker-compose"
alias dcu="docker-compose up -d"
alias dcub="docker-compose up --build -d"
alias dclogs="docker-compose logs -f"
alias dcdangling="docker volume rm `docker volume ls -q -f dangling=true`"
alias dcd="docker-compose down"
alias dcubd="docker-compose up --build -d"
alias yarnu="curl --compressed -o- -L https://yarnpkg.com/install.sh | bash"
# Grep dclogs with color (supply word to search for and container ID or name [optional] as params)
dccgl () {
if [ "$#" -eq 1 ]; then
docker-compose logs | grep -n --color "$1"
else
docker-compose logs "$1" | grep -n --color "$2"
fi
}
# SSH into a docker container (supply container ID or name as param)
dcbash () {
dc exec "$1" bash
}
# Kill and rebuild a container/image (supply container ID or name as param)
dcreboot () {
dc kill "$1" && dc rm "$1" && dc pull "$1" && dc up -d "$1"
}
# # # # # # #
# NVM STUFF #
# # # # # # #
find-up () {
path=$(pwd)
while [[ "$path" != "" && ! -e "$path/$1" ]]; do
path=${path%/*}
done
echo "$path"
}
# Ensure we call nvm use every time we enter a directory with an nvm.rc file
cdnvm(){
cd "$@";
nvm_path=$(find-up .nvmrc | tr -d '[:space:]')
# If there are no .nvmrc file, use the default nvm version
if [[ ! $nvm_path = *[^[:space:]]* ]]; then
declare default_version;
default_version=$(nvm version default);
# If there is no default version, set it to `node`
# This will use the latest version on your machine
if [[ $default_version == "N/A" ]]; then
nvm alias default node;
default_version=$(nvm version default);
fi
# If the current version is not the default version, set it to use the default version
if [[ $(nvm current) != "$default_version" ]]; then
nvm use default;
fi
elif [[ -s $nvm_path/.nvmrc && -r $nvm_path/.nvmrc ]]; then
declare nvm_version
nvm_version=$(<"$nvm_path"/.nvmrc)
# Add the `v` suffix if it does not exists in the .nvmrc file
if [[ $nvm_version != v* ]]; then
nvm_version="v""$nvm_version"
fi
# If it is not already installed, install it
if [[ $(nvm ls "$nvm_version" | tr -d '[:space:]') == "N/A" ]]; then
nvm install "$nvm_version";
fi
if [[ $(nvm current) != "$nvm_version" ]]; then
nvm use "$nvm_version";
fi
fi
}
alias cd='cdnvm'
export PS1="\[\033[33;1m\]\w\[\033[m\]\$(parse_git_branch)\[\033[00m\] $ "
# Set colors to match iTerm2 Terminal Colors
export TERM=xterm-256color
# Set CLICOLOR if you want Ansi Colors in iTerm2
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# Get thufuck working yo
eval $(thefuck --alias)
# Load bash aliases
source ~/.bash_aliases
source ~/.git-completion.bash
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
# For rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/
export PATH=$HOME/apache-maven-3.5.3/bin:$PATH
export GOPATH=$HOME/workspace/gospace
# Eternal bash history.
# ---------------------
# Undocumented feature which sets the size to "unlimited".
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
# Change the file location because certain bash sessions truncate .bash_history file upon close.
# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
export HISTFILE=~/.bash_eternal_history
# Force prompt to write history after every command.
# http://superuser.com/questions/20900/bash-history-loss
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
# Ensure we get nice time stamps for $history
export HISTTIMEFORMAT="%d/%m/%y %T "
# Ignore basic everday commands when reverse command searching
export HISTIGNORE="pwd:ls:cd:gsu"
# Stop fucking apple from shoving their preferences down my throat every day
export BASH_SILENCE_DEPRECATION_WARNING=1
module.exports = {
config: {
visor: {
hotkey: 'Ctrl+`',
position: 'top' // or left, right, bottom
},
paneNavigation: {
debug: false,
hotkeys: {
navigation: {
up: 'meta+alt+up',
down: 'meta+alt+down',
left: 'meta+alt+left',
right: 'meta+alt+right'
},
jump_prefix: 'meta+alt', // completed with 1-9 digits
maximize: 'meta+enter'
},
showIndicators: false
},
// default font size in pixels for all tabs
fontSize: 18,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
// `BEAM` for |, `UNDERLINE` for _, `BLOCK` for █
cursorShape: 'BLOCK',
// color of the text
foregroundColor: '#fff',
// terminal background color
backgroundColor: '#222',
// border color (window, tabs)
borderColor: 'rgba(248,28,229,0.8)',
// custom css to embed in the main window
css: '',
// custom css to embed in the terminal window
termCSS: '',
// set to `true` if you're using a Linux set up
// that doesn't shows native menus
// default: `false` on Linux, `true` on Windows (ignored on macOS)
showHamburgerMenu: '',
// set to `false` if you want to hide the minimize, maximize and close buttons
// additionally, set to `'left'` if you want them on the left, like in Ubuntu
// default: `true` on windows and Linux (ignored on macOS)
showWindowControls: 'false',
// custom padding (css format, i.e.: `top right bottom left`)
padding: '12px 14px',
// the full list. if you're going to provide the full color palette,
// including the 6 x 6 color cubes and the grayscale map, just provide
// an array here instead of a color map object
colors: {
black: '#000000',
red: '#ff0000',
green: '#33ff00',
yellow: '#ffff00',
blue: '#0066ff',
magenta: '#cc00ff',
cyan: '#00ffff',
white: '#d0d0d0',
lightBlack: '#808080',
lightRed: '#ff0000',
lightGreen: '#33ff00',
lightYellow: '#ffff00',
lightBlue: '#0066ff',
lightMagenta: '#cc00ff',
lightCyan: '#00ffff',
lightWhite: '#ffffff'
},
// the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
// if left empty, your system's login shell will be used by default
shell: '',
// for setting shell arguments (i.e. for using interactive shellArgs: ['-i'])
// by default ['--login'] will be used
shellArgs: ['--login'],
// for environment variables
env: {},
// set to false for no bell
bell: 'SOUND',
// if true, selected text will automatically be copied to the clipboard
copyOnSelect: true
// URL to custom bell
// bellSoundURL: 'http://example.com/bell.mp3',
// for advanced config flags please refer to https://hyper.is/#cfg
},
// a list of plugins to fetch and install from npm
// format: [@org/]project[#version]
// examples:
// `hyperpower`
// `@company/project`
// `project#1.0.1`
plugins: [
'hyper-transparent',
'hyperline',
'hyper-chesterish',
'hyper-tabs-enhanced',
'hyperborder',
'hyper-pane',
'hypercwd',
'hyperterm-visor',
'hyper-search',
'hyper-autohide-tabs'
],
// in development, you can create a directory under
// `~/.hyper_plugins/local/` and include it here
// to load it and avoid it being `npm install`ed
localPlugins: []
}
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
"Print Object": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "po",
"body": [
"// eslint-disable-next-line no-console",
"console.log('$CLIPBOARD:', JSON.stringify($CLIPBOARD, null, 2))"
],
"description": "Log a formatted object output to console"
},
"Set Debugger": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "db",
"body": ["debugger // eslint-disable-line"],
"description": "Set a debugger and ignore it during linting"
},
"Function Called": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "fc",
"body": ["// eslint-disable-next-line no-console", "console.log('$CLIPBOARD has been called.')"],
"description": "Add a basic console log to indicate the function was called"
},
"Console Log": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "clg",
"body": ["// eslint-disable-next-line no-console", "console.log('$1')"],
"description": "Standard console.log"
},
"Console Log Count": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "clgc",
"body": ["// eslint-disable-next-line no-console", "console.count('$CLIPBOARD')"],
"description": "Standard labled console.count"
},
"Console Log Table": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "clt",
"body": ["// eslint-disable-next-line no-console", "console.table({$CLIPBOARD})"],
"description": "Standard console.log"
},
"Console Log A Thing": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "clgt",
"body": ["// eslint-disable-next-line no-console", "console.log('$CLIPBOARD:', $CLIPBOARD)"],
"description": "Standard labled console.log"
},
"Getting Here": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "gh",
"body": ["// eslint-disable-next-line no-console", "console.log('Getting here -> $CLIPBOARD')"],
"description": "Standard labled console.log"
},
"Before Each": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "be",
"body": ["beforeEach(() => {$1})"],
"description": "Create a before each loop for use in tests"
},
"Named Export": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "ne",
"body": ["export { $CLIPBOARD }"],
"description": "Create a named export from clipboard"
},
"Export Default": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "ed",
"body": ["export default $CLIPBOARD"],
"description": "Create a default export from clipboard"
},
"Arrow Func": {
"scope": "javascript,typescript,typescriptreact",
"prefix": "af",
"body": ["const $1 = ($2) => {", " $3", "}"],
"description": "Create an empty arrow function"
},
// NOT MINE
"React Function Component": {
"prefix": "trfc",
"body": [
"interface $1Props {",
" $2: $3",
"}",
"export const $1: React.FC<$1Props> = ({ $2 }) => {",
" return (",
" $0",
" )",
"}",
"",
"export { $1 }"
],
"description": "Create a React Function Component"
},
}
Embarrased (my extension)
Google Searcher (my extension)
Apollo Client Dev Tools
Chrome Remote Desktop
ColorZilla (color picker)
Daily.dev (articles on new page)
Dark Reader (adrk mode for wikipedia etc)
Gifs for Github
Google Arts and Culture (art on new tab)
Google dictionary
Json Formatter
Lastpass
Link to Text Fragment
Mindful Break
Minerva (for guides on websites)
Noisli (ambient sounds)
Notion Web Clipper
Octotree (GH tree view)
Project Naptha (for getting text from images)
React dev tools
Redux dev tools
Refined Github
Session Buddy
Svelte dev tools
Tab Wrangler
Todoist
uBlock Origin
User CSS
Wappalyzer (for seeing tech on website)
XState dev tools
Rectangle: window manager
Trailer: github helper
Maccy: clipboard history
Boom 3D: equaliser
Rocket: emojis
Flux: improved brightness
Kap: screenshots, gifs and videos
Hidden Bar: bar organiser
Spotify: music
VSCode: IDE
Chrome: browser
Slack: chat
Caffeine: Mac wakefulness
Charles: proxy
Hyper: terminal
Snap Camera: video filters
ZSH / OHMYZSH / Antigen: CLI
Karabiner Elements: keyboard mapper
{
// Linting
"prettier.semi": false,
"prettier.singleQuote": true,
// Functionality
"php.suggest.basic": false,
"editor.renderIndentGuides": true,
"workbench.startupEditor": "newUntitledFile",
"window.newWindowDimensions": "maximized",
"editor.tabCompletion": "on",
"breadcrumbs.enabled": true,
"files.exclude": {
".yarn/**": true,
"**/.DS_Store": true,
"cypress/**/*.json": true,
"yarn.lock": true
},
"editor.wordWrap": "on",
"javascript.updateImportsOnFileMove.enabled": "always",
"typescript.updateImportsOnFileMove.enabled": "always",
"go.formatTool": "goimports",
// Aesthetics
"bracket-pair-colorizer-2.showBracketsInGutter": true,
"bracket-pair-colorizer-2.showVerticalScopeLine": false,
"editor.fontFamily": "'Fira Code', Source Code Pro, mononoki, Menlo, Monaco, 'Courier New', monospace",
"workbench.fontAliasing": "antialiased",
"editor.fontLigatures": true,
"editor.fontWeight": "normal",
"editor.tabSize": 2,
"editor.renderWhitespace": "none",
"workbench.colorCustomizations": {
"statusBar.background": "#222630",
"statusBar.border": "#222630",
"statusBar.debuggingBackground": "#511f1f",
"editor.selectionBackground": "#555"
},
"window.zoomLevel": 2,
"editor.smoothScrolling": true,
"editor.lineHeight": 24,
"workbench.editor.labelFormat": "short",
"editor.cursorBlinking": "phase",
"editor.cursorSmoothCaretAnimation": true,
"editor.minimap.renderCharacters": false,
"editor.minimap.enabled": true,
"bracket-pair-colorizer-2.showHorizontalScopeLine": false,
// Search
"search.exclude": {
"**/web": true,
"**/web/js": true,
"**/assets/templates/cache": true,
"**/node_modules": true,
"**/bower_components": true,
"**/__snapshots__": true
},
// Dictionary
"cSpell.userWords": [
"APAC",
"Angular's",
"BARCODES",
"Checkboxes",
"EMEA",
"Raygun",
"Tickable",
"Typey",
"Uncheck",
"Unmount",
"Xsrf",
"Youtube",
"antialiased",
"backend",
"battletag",
"behaviour",
"deduplicated",
"dropdown",
"entrypoint",
"initialise",
"lightbox",
"luxafor",
"monoliph",
"netlify",
"pagerduty",
"performant",
"reactstrap",
"repo",
"skus",
"typeist",
"unmark",
"unticked",
"uploader",
"vendhq",
"webhook",
"yolo",
"zendesk"
],
// File assosciations
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
// Golang
"go.useLanguageServer": true,
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.snippetSuggestions": "none"
},
"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"gopls": {
"usePlaceholders": true,
"staticcheck": false
},
// General
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"workbench.colorTheme": "Nord",
"editor.renderControlCharacters": false,
"workbench.statusBar.visible": true,
"workbench.activityBar.visible": false,
"vsicons.dontShowNewVersionMessage": true,
"explorer.confirmDelete": false,
"terminal.integrated.cursorBlinking": true,
"terminal.integrated.cursorStyle": "line",
"terminal.integrated.lineHeight": 1.1,
"terminal.integrated.fontWeightBold": "100",
"terminal.integrated.fontWeight": "100",
"terminal.integrated.fontSize": 11,
"terminal.integrated.scrollback": 20000,
"go.autocompleteUnimportedPackages": true,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
"todo-tree.tree.showScanModeButton": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment