summaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2017-01-16 07:32:44 -0500
committerJesse Luehrs <doy@tozt.net>2017-01-21 06:37:31 -0500
commitdc6416f8d45f02b5ba9e38a4236c1821a4cf596e (patch)
tree3594beb07b645598574622c9a6fe4a2b5351185d /functions
parent37136d5493410cf2f5b72184f952794f33be566e (diff)
downloadconf-dc6416f8d45f02b5ba9e38a4236c1821a4cf596e.tar.gz
conf-dc6416f8d45f02b5ba9e38a4236c1821a4cf596e.zip
split most functions out into scripts
Diffstat (limited to 'functions')
-rw-r--r--functions120
1 files changed, 0 insertions, 120 deletions
diff --git a/functions b/functions
index 78e07fd..5622940 100644
--- a/functions
+++ b/functions
@@ -1,11 +1,3 @@
-function web {
- local port=$1
- if [[ -z $port ]]; then
- plackup -MPlack::App::Directory -e'Plack::App::Directory->new'
- else
- plackup -MPlack::App::Directory -e'Plack::App::Directory->new' --port $port
- fi
-}
function perldoc {
# XXX bash specific
if type cpandoc > /dev/null 2>&1; then
@@ -14,117 +6,5 @@ function perldoc {
command perldoc "$@"
fi
}
-function webcam {
- local width=$1
- local height=$2
- if [[ -z $width ]]; then width=640; fi
- if [[ -z $height ]]; then height=480; fi
- mplayer tv:// -tv driver=v4l2:width=${width}:height=${height}:device=/dev/video0 -fps 15 -vf screenshot
-}
-function webcam_record {
- local width=$1
- if [[ -z $width ]]; then width=640; else shift; fi
- local height=$1
- if [[ -z $height ]]; then height=480; else shift; fi
- mencoder tv:// -tv driver=v4l2:width=${width}:height=${height}:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o $1
-}
-function setfont {
- printf '\e]710;%s\007\e]711;%s\007' "$1" "$1"
-}
-function mem_usage {
- ps -eo rss,ucmd | sort -rn | head -n$([ -z "$1" ] && echo 20 || echo $1)
-}
-function opened_files {
- strace $* 2>&1 | grep -E '^open\(' | \
- grep -v ENOENT | \
- grep -v O_DIRECTORY | \
- cut -f2 -d"\"" | \
- grep -vE '^/proc/' | \
- grep -v '^/sys/' | \
- grep -v '^/dev/'
-}
-function alert {
- echo "DISPLAY=$DISPLAY xmessage -center -default okay $1" | at $2
-}
-function fm22avi {
- fceux --playmov $1.fm2 --sound 1 --soundq 1 --soundrate 48000 --nospritelim 1 --pal 0 --xscale 1 --yscale 1 --opengl 0 --special 0 $2 --videolog "mencoder - -o $1.avi -ovc x264 -x264encopts qp=0 -oac mp3lame -lameopts mode=3:preset=128 -noskip -nocache -mc 0 -aspect 4/3 NESVSETTINGS"
-}
-function pdfcat {
- local out=$1
- shift
- gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$out $*
-}
-function svup {
- svc -u "$HOME/.services/$1"
- svget "$1"
-}
-function svstop {
- svc -d "$HOME/.services/$1"
- svget "$1"
-}
-function svkill {
- svc -k "$HOME/.services/$1"
- svget "$1"
-}
-function svdn {
- svst "$1" && svstop "$1"
- svst "$1" && sleep 1
- svst "$1" && svstop "$1"
- for i in 1..5; do
- svst "$1" && sleep 1
- done
- svst "$1" && svstop "$1"
- for i in 1..10; do
- svst "$1" && sleep 1
- done
- svst "$1" && svkill "$1"
-}
-function svget {
- svstat "$HOME/.services/$1"
-}
-function svst {
- svget "$1" | grep -q ": up ("
-}
-function svre {
- svdn "$1"
- svup "$1"
-}
-function svlog {
- tail -F "$HOME/.log/$1/current" | tai64nlocal
-}
-function pick_music {
- lastfm_export --user doyster --dsn dbi:SQLite:${HOME}/.tracks.sqlite
- sqlite3 ${HOME}/.tracks.sqlite "SELECT artist FROM yearly_tracks WHERE artist NOT IN (SELECT DISTINCT(artist) FROM weekly_tracks) GROUP BY artist ORDER BY count(artist) * (strftime('%s') - max(timestamp)) DESC LIMIT $([ -z "$1" ] && echo 20 || echo $1)"
-}
-function rand_music {
- local db
- if [[ $1 == '--old' ]]; then
- db=old_tracks
- shift
- else
- db=yearly_tracks
- fi
- lastfm_export --user doyster --dsn dbi:SQLite:${HOME}/.tracks.sqlite
- for i in $(seq 1 $([ -z "$1" ] && echo 20 || echo $1)); do
- echo "select distinct(artist) from $db where artist not in (select distinct(artist) from weekly_tracks);" | sqlite3 ~/.tracks.sqlite | rand_line | sed "s/'/''/" | sed "s/.*/select artist, album from $db where artist = '&' group by artist, album;/" | sqlite3 ~/.tracks.sqlite | rand_line | sed 's/|/ - /'
- done
-}
-function t {
- if [[ -d blib ]]; then
- perl -Mblib -MTest::Pretty "$@"
- else
- perl -Ilib -MTest::Pretty "$@"
- fi
-}
-function pt {
- if [[ -d blib ]]; then
- prove -Mlib::require::all=blib/lib,blib/arch -Pretty -b "$@" t
- else
- prove -Mlib::require::all=lib -Pretty -l "$@" t
- fi
-}
-function hostcert {
- openssl s_client -connect "$1" < /dev/null 2>/dev/null | perl -nle 'print if /BEGIN CERTIFICATE/../END CERTIFICATE/' | openssl x509 -text | perl -nle 'print unless /BEGIN CERTIFICATE/../END CERTIFICATE/'
-}
# vim:ft=sh: