This file contains hidden or 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-create() { | |
repo_name=`basename $(git config --local --get remote.origin.url)` | |
dir_name=`basename $(pwd)` | |
invalid_credentials=0 | |
if [ "$repo_name" = "" ]; then | |
echo " Repo name (hit enter to use '$dir_name')?" | |
read repo_name | |
fi |
This file contains hidden or 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
var __next_objid = 1; | |
function objectId(obj) { | |
if (!obj) return obj; | |
if (!obj.__obj_id) obj.__obj_id = __next_objid++; | |
return obj.__obj_id; | |
} |
This file contains hidden or 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
#!/bin/bash | |
# | |
# DROPKICK.SH | |
# | |
# From http://julianoliver.com/output/log_2015-12-18_14-39 | |
# | |
# Detect and Disconnect the DropCam and Withings devices some people are using to | |
# spy on guests in their home, especially in AirBnB rentals. Based on Glasshole.sh: | |
# | |
# http://julianoliver.com/output/log_2014-05-30_20-52 |
This file contains hidden or 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
# Move the current head so that it's pointing at the old commit | |
# Leave the index intact for redoing the commit. | |
# HEAD@{1} gives you "the commit that HEAD pointed at before | |
# it was moved to where it currently points at". Note that this is | |
# different from HEAD~1, which gives you "the commit that is the | |
# parent node of the commit that HEAD is currently pointing to." | |
git reset --soft HEAD@{1} | |
# commit the current tree using the commit details of the previous | |
# HEAD commit. (Note that HEAD@{1} is pointing somewhere different from the |
This file contains hidden or 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
# if branch_name exists, it will return its hash | |
# if not, it will returns null | |
git rev-parse --verify --quiet branch_name |
This file contains hidden or 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
fullpath_name="/usr/local/a-file-name" | |
filename1=${fullpath_name##*/} | |
pathname1=${fullpath_name%/*} | |
absolute_path=$(readlink -f "$0") | |
echo $filename1 # return a-file-name | |
echo $pathname1 # return /usr/local/ | |
echo $absolute_path # return /usr/local/a-file-name | |
### OR using basename and dirname |
This file contains hidden or 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
### variable doesn't exist | |
echo $variable1 | |
variable1="${variable1:-default value}" | |
echo $variable1 | |
# return default value | |
### variable exists | |
variable2="a" | |
echo $variable2 |
This file contains hidden or 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
# http://stackoverflow.com/questions/6205157/iterm2-how-to-get-jump-to-beginning-end-of-line-in-bash-shell | |
FOR ACTION SEND | |
⌘← "HEX CODE" 0x01 | |
⌘→ "HEX CODE" 0x05 | |
⌥← "SEND ESC SEQ" b | |
⌥→ "SEND ESC SEQ" f |
This file contains hidden or 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
[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "Click" |
This file contains hidden or 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
# /bin/bash | |
# To create a symbolic link to the airport command. | |
# Make sure /usr/local/sbin is in your PATH | |
# echo $PATH | |
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/sbin/airport | |
# Display detailed information on wireless signal quality, noise, security, and other WiFi network attributes. | |
airport -I |