Snippets are the most useful when you want to re-use a command or a specific code pattern. Here are a few we have in our library:
- How to delete a git tag
- Nginx configuration for staging server
- Crash handler AWS Lambda function
#!/bin/bash | |
### | |
# Use -r to compare against a remote branch | |
### | |
## Example w/o this script | |
## git fetch --all | git rev-list --left-right --count origin/master...master | |
$USAGE="$0 [-r <remote branch>]" |
#!/bin/bash | |
# must install JQ | |
# https://stedolan.github.io/jq/download/ | |
# on OSX brew install jq | |
# must set Github Personal Access Token with full repo access only | |
### Set named arguments -t | |
while getopts ":t:" opt; do |
brew cask install ngrok
ngrok http -host-header=my.site.local 80
wp-config.php
<?php
// Add a value if using NGROK
On macOS using Homebrew run the following to install the packages
brew install cowsay fortune lolcat
Next add the following to ~/.bash_profile
# If brew installed fortune, cowsay, and lolcat
# Upon opening a new shell show a cowsay character with a random forutune in rainbow colors
This can occur when using composer to manage dependencies. From the dependency directory
git remote -v
will list origin as well as composer. The branch will appear as hash.
If the branch exists on the remote already you can run git fetch --all
before setting up the tracking.
I believe both of these acomplish the same thing
git checkout [branch] --track [remote]/[branch]
git checkout -b [branch] [remote]/[branch]
# ZSH may require the versions to be in quotes (see comments below) | |
# Check version | |
node -v || node --version | |
# List installed versions of node (via nvm) | |
nvm ls | |
# Install specific version of node | |
nvm install 6.9.2 |
# Apache logs location on Ubuntu | |
cd /var/log/apache2 | |
# Apache logs location on my local macOS | |
cd ~/Sites/logs | |
# Tail Logs, only show rows with specific info (like my ip address) | |
tail -f /var/log/apache2/[site].log | grep [search term] | |
# Search through zipped log files for some piece of data (ip/email etc.) |
# List only directories in the current location | |
ls -d */ | |
# List files and directories with permissions and dates | |
ls -lh | |
# Remove white-sapce (tabs, spaces, and new lines) | |
sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' -e 's/[\t ]//g;/^$/d' |