Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View wchrisjohnson's full-sized avatar

Chris Johnson wchrisjohnson

View GitHub Profile
@wchrisjohnson
wchrisjohnson / restart-network-services
Created March 2, 2021 18:10 — forked from stevenharman/restart-network-services
Restart Active Network Services on your Mac. You know, for the VPN!
#! /usr/bin/env bash
# shellcheck disable=SC2059
set -euo pipefail
# Toggle all currently 'Active' network servcies (e.g., Wi-Fi, Ethernet
# connections, etc...) to "restart" them. We'll ignore any already 'Disabled'
# services, and toggle all of the others to 'Disabled' and then back to
# 'Enabled'. This has been found helpful when your VPN won't re-connect after
# undocking and re-docking your MacBook, for example.
@wchrisjohnson
wchrisjohnson / tmux-cheatsheet.markdown
Created July 23, 2018 19:41 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@wchrisjohnson
wchrisjohnson / search-git-history.md
Created February 15, 2018 18:09 — forked from lyoshenka/search-git-history.md
Search Git commit history for a string and see the diffs

Searching Git commit history

This should be one of the core features of Git, but for some reason it's impossible to figure out how to search for a string in your commit history and see the diffs that that string is in. Here's the best I've come up with:

To find which commits and which files a string was added or removed in:

git log -S'search string' --oneline --name-status

To see the diff of that

2017/06/02 20:57:26 [INFO] Terraform version: 0.9.6
2017/06/02 20:57:26 [INFO] Go runtime version: go1.8.3
2017/06/02 20:57:26 [INFO] CLI args: []string{"/usr/local/Cellar/terraform/0.9.6/bin/terraform", "env", "new", "va02"}
2017/06/02 20:57:26 [DEBUG] Detected home directory from env var: /Users/johnson.chris
2017/06/02 20:57:26 [DEBUG] Discovered plugin: herokuinternal = /Users/johnson.chris/.terraform.d/plugins/terraform-provider-herokuinternal
2017/06/02 20:57:26 [DEBUG] Discovered plugin: libratointernal = /Users/johnson.chris/.terraform.d/plugins/terraform-provider-libratointernal
2017/06/02 20:57:26 [DEBUG] Detected home directory from env var: /Users/johnson.chris
2017/06/02 20:57:26 [DEBUG] Attempting to open CLI config file: /Users/johnson.chris/.terraformrc
2017/06/02 20:57:26 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2017/06/02 20:57:26 [DEBUG] Detected home directory from env var: /Users/johnson.chris
@wchrisjohnson
wchrisjohnson / README.md
Created August 4, 2016 17:14 — forked from hofmannsven/README.md
My simply Git Cheatsheet
Thu Jun 16 03:48:29 UTC 2016
@wchrisjohnson
wchrisjohnson / docker-machine-vmfusion.sh
Created March 10, 2016 02:10
Basic workflow for docker-machine on Mac with VMWare Fusion
# Get everything ready on a Mac
brew install docker docker-machine docker-compose
# Create a new machine (based on the 1.8.1 boot2docker iso)
docker-machine create --driver vmwarefusion --vmwarefusion-memory-size 2048 --vmwarefusion-boot2docker-url https://github.com/boot2docker/boot2docker/releases/download/v1.9.1/boot2docker.iso osxdock
# Bring the machine up
docker-machine start osxdock
# Configure Shell
@wchrisjohnson
wchrisjohnson / node-and-npm-in-30-seconds.sh
Created March 9, 2016 08:37 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@wchrisjohnson
wchrisjohnson / fix-homebrew-npm.md
Created March 9, 2016 07:03 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

module SomeRequest
class Real
def do_something
RequestCommon.base_request(...)
end
end
end