This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# easy way to remove circular references when stringifying | |
var cache = []; | |
JSON.stringify(o, function(key, value) { | |
if (typeof value === 'object' && value !== null) { | |
if (cache.indexOf(value) !== -1) { | |
// Circular reference found, discard key | |
return; | |
} | |
// Store value in our collection | |
cache.push(value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When you get this: "The authenticity of host 'HOSTNAME (IP)' can't be established.", | |
# including a fingerprint, and then "Are you sure you want to continue connecting (yes/no)?". | |
# This is due to a hostname check previously accepted fingerprint/hostname. | |
# This isn't helpful during automated tests, turn it off with this: | |
StrictHostKeyChecking=no | |
# get fingerprint of server | |
ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub | |
# The following useful in /etc/ssh/ssh_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Used for my Windows 10 bash terminal | |
# This tmux usually has remote tmux's nested in it | |
# change status bar background to yellow so it doesn't confuse me with remote session's color | |
set -g status-bg yellow | |
# set current window's background to green to match remote session's color | |
set -g window-status-current-bg green | |
# turn off C-b for this Windows session, since we always remote into another tmux ssession | |
set-option -g prefix C-n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In CentOs 6, edit /etc/sysctl.conf | |
fs.inotify.max_user_watches = 524288 | |
# Then make change take effect | |
sudo sysctl -p | |
# Then start up IntelliJ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git Secrets | |
# how to find the commit that deleted a file | |
# find a file that you're not certain where it is anymore, if it's been deleted | |
git log --all --full-history -- "*MyFile.*" | |
# find the path of the above | |
git show --pretty="" --name-only <sha1-commit-hash> | |
# now limit the above file's commits to just the exact path you want | |
git log --all --full-history -- <path-to-file> | |
# take the last commit, that'll show you the commit that deleted the file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conditionally set one parameter to another, or use default value | |
# If ${1} is unset or null, this will set SOME_VAR to "default_value" instead | |
SOME_VAR=${1:-default_value} | |
# If ${1} is unset or null, this will set SOME_VAR to the value of OTHER_VAR instead | |
SOME_VAR=${1:=OTHER_VAR} | |
# ^M | |
# in vim | |
# no really | |
# here's how to enter ^M so that you can remove it from a file |