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 | |
## requires iotop to be installed | |
sudo iotop -botqqqk --iter=600 >> iotop.log | |
cat iotop.log \ | |
## remove characters before write speed | |
| cut -c 41- \ | |
## look for any write speed that is non-zero |
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
## Bash lets you use CTRL+X CTRL+E to edit-and-execute a command | |
## This will allow you to set up VS Code as the editor for this (and other Bash edit functions) | |
echo "export VISUAL=\"code -n -w\"" >> ~/.bashrc | |
source ~/.bashrc | |
## Then when you're typing a long command and need to change something or otherwise want better | |
## editing control over a command, simply hit CTRL+X CTRL+E and edit the command, then save | |
## and exit VS Code and the command will execute | |
## For Sublime Text |
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
-- Scenario: There should only exist one record for each distinct value for column A that has column B set to true. There can be any number of records for each distinct value for column A where column B is false. | |
-- i.e. there can be only one active record (column B true) for each distinct value of column A | |
DROP TABLE IF EXISTS test; | |
CREATE TABLE test ( | |
"a" CHARACTER VARYING(3) NOT NULL, | |
"b" BOOLEAN NOT NULL DEFAULT TRUE | |
); |
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
ruby d:\dev\sh\sourcetree\sourcetree-open-on-github.rb %1 |
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 | |
git stash list | |
echo "Enter stash number to rename" | |
read stash_number | |
echo "Enter new name" | |
read new_name | |
stash_name="stash@{${stash_number}}" | |
echo "$stash_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
#!/bin/bash | |
echo "Cleaning git merge conflict artifacts..." | |
find . -name "*.bak" | while read filename; do echo "Removing: $filename" && rm -rf "$filename"; done | |
echo -e "\n" | |
echo "Counting unreachable objects in git database..." | |
unreachable=$(git fsck --unreachable | wc -l) | |
echo "There are $unreachable unreachable objects." |
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 | |
# "master" is the name of your main branch you'll be comparing to, or you can pass the "parent" branch as an argument | |
# it compares against the current branch by default, but you can pass a second argument to specify a child branch | |
# this creates a permanent alias so you can use `git oldest-ancestor` to get the oldest ancestor of the current branch at any time | |
git config --global alias.oldest-ancestor '!zsh -c '\''diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "${1:-master}") <(git rev-list --first-parent "${2:-HEAD}") | head -1'\'' -' |
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 | |
# did you pass all the arguments? | |
nl=$'\n' | |
if [ $# -lt 3 ]; then | |
echo 1>&2 "$0: not enough arguments${nl}USAGE: changes-between-commits.sh \"Author Name\" FROM_COMMIT_SHA TO_COMMIT_SHA" | |
exit 2 | |
elif [ $# -gt 3 ]; then | |
echo 1>&2 "$0: too many arguments${nl}USAGE: changes-between-commits.sh \"Author Name\" FROM_COMMIT_SHA TO_COMMIT_SHA" | |
exit 2 |
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
cat log.log | grep '\[2016\-05' | cut -c 23- | sort | uniq -c | sort -rn > 2016-05_error_count.log |