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
import json | |
# TODO - redact jira instance name | |
def redact_data(data): | |
if isinstance(data, dict): | |
for key, value in data.items(): | |
if key in ['name', 'emailAddress', 'displayName', 'summary', 'description']: | |
data[key] = 'redacted' | |
elif key in ['fromString', 'toString']: |
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
require 'csv' | |
query = ARGV[0] # Alfred | |
if query | |
col_sep = query | |
else | |
col_sep = "\t" | |
end | |
clipboard = `pbpaste` |
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
alias yd='youtube-dl -x --audio-format m4a' | |
alias slime='open -a "Sublime Text"' | |
alias ax='chmod a+x' | |
alias ff='open -a Finder ./' | |
alias p='ps aux| grep -v grep| grep -i' | |
alias h='history' | |
function cdf | |
set target (osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)') | |
if [ $target ] | |
cd $target |
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
# Find and count file extensions in a directory | |
find . -type f | sed -e 's/.*\.//' | sort | uniq -c | sort -rn | |
# Rename group of files | |
for old in \*.txt; do mv $old `basename $old .txt`.md; done | |
# Resize group of images | |
for f in \*.jpg; do convert $f $f.pdf; done | |
# Download youtube playlist video |
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
require 'date' | |
def network_days(start_date, end_date) | |
days_between = (end_date - start_date).to_i | |
whole_weeks, extra_days = days_between.divmod(7) | |
unless extra_days.zero? | |
extra_days -= if (start_date + 1).wday <= end_date.wday | |
[(start_date + 1).sunday?, end_date.saturday?].count(true) | |
else |
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
data=$(pbpaste) | |
if [ $(echo "$data" | wc -l) -gt 1 ]; | |
then | |
change=${data// | |
/ } | |
else | |
change=${data// / | |
} | |
fi | |
echo -e "$change" | pbcopy |