Skip to content

Instantly share code, notes, and snippets.

@oroce
Created October 10, 2018 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oroce/9f8b1bfac185302ae4b2a7f37c42eac1 to your computer and use it in GitHub Desktop.
Save oroce/9f8b1bfac185302ae4b2a7f37c42eac1 to your computer and use it in GitHub Desktop.
function onport(){
lsof -n -i4TCP:$1 | grep LISTEN
}
function tmuxhelp() {
open "https://gist.github.com/henrik/1967800"
}
function weather() {
curl -4 wttr.in
}
function killssh() {
PATTERN=""
if [ -n "$@" ]; then
PATTERN="$@"
fi
ps aux | grep ssh | grep "$PATTERN" | grep -v grep | awk '{print $2}' | xargs kill -9
}
function pdf-to-black-and-white() {
if [ "$1" == "" ]; then
echo -e "USAGE: pdf-to-black-and-white input.pdf\nIt will write an output.pdf\n\n pdf-to-black-and-white input.pdf out2.pdf\nit will an out2.pdf"
return 1
fi
OUTPUT="$2"
gs -sOutputFile=${OUTPUT-output.pdf} \
-sDEVICE=pdfwrite \
-sColorConversionStrategy=Gray \
-dProcessColorModel=/DeviceGray \
-dCompatibilityLevel=1.4 \
-dNOPAUSE \
-dBATCH \
$1
}
function optim-image() {
if [ "$1" == "" ]; then
echo "output is missing";
return -1;
fi
convert -strip -interlace Plane -quality 85% "$1" "$2"
}
function mkdirp {
mkdir -p $1 && pushd $1
}
function concat() {
ls *.{mp4,MP4,MOV,mov} 2>/dev/null | perl -ne 'print "file $_"' | ffmpeg -f concat -i - -c copy $1
}
function vudo() { eval "vagrant ssh -c \"cd /vagrant && $@\"" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment