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
#!/bin/sh | |
ls -ldt * | head -n 1 | tr -s ' ' | cut -d ' ' -f 9- |
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
__colorize_arg () | |
{ | |
local color='' | |
case "$1" in | |
# Other options: AM, AM/REBASE, CHERRY-PICKING, BISECTING | |
*'|MERGING'* | *'|REBASE'*) # Merging or rebasing | |
color="0;31" # Red | |
;; | |
*'*+'*) # Unstaged + staged |
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
#!/bin/sh | |
_echo_usage_and_abort() { | |
echo "Usage: $0 {start|stop} [interval]" | |
exit 1 | |
} | |
if [[ ! -d '.hg' ]]; then | |
cat <<EOM | |
This directory does not appear to be a mercurial repository. Try running this |
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
#!/bin/bash | |
if [[ -z "$1" ]]; then | |
_monitor_dir="$HOME/Pictures" | |
else | |
_monitor_dir="$1" | |
fi | |
if [[ ! -d "${_monitor_dir}" ]]; then | |
echo "Can't find directory '${_monitor_dir}', does it exist?" | |
exit 1 |
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
watch -n 1 "lsof -F pan /mnt/gentoo 2> /dev/null | grep -Ev '^p' | sed -r '/a./{N;s/^a(.)\nn/\1/}' | cut -d / -f 1,5-8 | grep -Ev '^\s*$' | cut -c 1,3- --output-delimiter=' ' | sort | uniq -c | sed -r 's/ ([0-9]) /0\1 /g' | sort -r" |
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
zfs list -t snapshot | egrep --color=none '^\S+\s+[[:digit:]]+(\.[[:digit:]]+)?[GM]' | sort -rnk 2 |
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
<!-- | |
Original snippet is from | |
http://www.communardo.de/home/techblog/2011/05/02/improve-the-confluence-pagetree-macro-functionality/ | |
--> | |
<script type="text/javascript" > | |
AJS.toInit(function ($) { | |
var currentChildClicked = false; | |
AJS.bind("pagetree-children-loaded", function() { | |
if(!currentChildClicked) { |
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
export MANPAGER="/bin/sh -c \"col -b | vim -c 'set mouse=a ft=man ts=8 nomod nolist nonu noma' -c 'runtime! macros/less.vim' -\"" |
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
function hashrate() { echo $(($(fgrep 'Total: ' ${1}.out | egrep -o '[0-9]+ khash/s' | awk '{ print $1 }' | tail -n +2 | paste -sd+ | bc) / $(fgrep 'Total: ' ${1}.out | egrep '[0-9]+ khash/s' | tail -n +2 | wc -l))); } |
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
#!/bin/bash -ex | |
exec aws cloudwatch list-metrics \ | |
| jq -r ' | |
.Metrics | |
| reduce .[] as $item ({}; .[$item.Namespace] |= { | |
names: (.names + [$item.MetricName] | unique), | |
dimensions: (.dimensions + [$item.Dimensions[].Name?] | unique) | |
}) | |
| to_entries |
OlderNewer