Browse Source

fired drew

master
John ShaggyTwoDope Jenkins 8 years ago
commit
2832bca6d3
  1. 1
      .xkcd.url
  2. 39
      6.sh
  3. BIN
      SDL-Test
  4. BIN
      VisualBoyAdvance
  5. 227
      VisualBoyAdvance.cfg
  6. 12
      alonetraytoggle.sh
  7. 46
      archive
  8. 10
      aur
  9. 6
      aurxfce.sh
  10. 43
      backup
  11. 7
      backup-arch
  12. 16
      backupx
  13. 44
      barmk.sh
  14. 24
      bl
  15. 20
      burn
  16. 18
      cabal-up
  17. 10
      calc
  18. 7
      chat
  19. 1
      clireddit
  20. 137
      cliweather
  21. 22
      conkydzen.sh
  22. 51
      conkyi3bar.sh
  23. 28
      cpu
  24. BIN
      cpubar
  25. 135
      cpubar.c
  26. BIN
      dbar
  27. 198
      dbar.c
  28. 6
      dirmailcheck.sh
  29. 46
      dna.sh
  30. 22
      dropboxdoom
  31. 15
      dzen_calendar.sh
  32. 6
      filemanager
  33. 136
      gcontacts
  34. 19
      gensetup
  35. 53
      getnetrc
  36. 12
      gh-read
  37. 22
      gifcast
  38. 45
      glyphs
  39. 6
      gmailmail.sh
  40. 22
      handle-acpi
  41. 19
      hb
  42. 24
      hdist
  43. 20
      hdocs
  44. 36
      hi-setup
  45. 35
      hs-ctags
  46. 595
      icdiff
  47. BIN
      icons/smileicon.png
  48. BIN
      ideas
  49. 7
      img
  50. 38
      imgt
  51. 337
      imgur.sh
  52. 115
      imgurup
  53. 6
      irc
  54. 18
      iso
  55. 326
      localcheck
  56. 6
      mail
  57. 25
      mail-notify
  58. 15
      mailnotify.sh
  59. 28
      mailrun.sh
  60. 62
      memory
  61. 7
      menu
  62. 40
      mp3-cleanup
  63. 11
      mpd-launcher
  64. 6
      music
  65. 37
      nmixer
  66. 18
      offlineimap-notify.sh
  67. 21
      opandoc
  68. 36
      osb
  69. 11
      osdinfo.sh
  70. 64
      osdmixer.sh
  71. 21
      osn
  72. 6
      packsize.sh
  73. 24
      pacman-mirror-update
  74. 6
      pacmanxfce.sh
  75. 24
      pacnews
  76. 36
      pacprune
  77. 98
      panel_bar
  78. 10
      pbar
  79. 51
      pipes.sh
  80. 28
      pomf
  81. 20
      ppkgbuild
  82. 53
      pulsevolumecheck.sh
  83. 12
      push
  84. 62
      radio
  85. BIN
      randompass
  86. 59
      randompass.c
  87. 76
      read-github-notification
  88. 4
      readlater.sh
  89. 5
      readlaterprompt
  90. 6
      reddit
  91. 143
      reddit.sh
  92. BIN
      repeater
  93. 15
      repeater.c
  94. 28
      restore
  95. 6
      rss
  96. 4
      rssadd.sh
  97. 5
      rtorrent-magnet
  98. 22
      runx
  99. 61
      shaggyinfo
  100. 106
      shaggystatus
  101. Some files were not shown because too many files have changed in this diff Show More

1
.xkcd.url

@ -0,0 +1 @@ @@ -0,0 +1 @@
http://imgs.xkcd.com/comics/trolley_problem.png

39
6.sh

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
#!/bin/sh
# ANSI Color -- use these variables to easily have different color
# and format output. Make sure to output the reset sequence after
# colors (f = foreground, b = background), and use the 'off'
# feature for anything you turn on.
initializeANSI()
{
esc=""
blackf="${esc}[30m"; redf="${esc}[31m"; greenf="${esc}[32m"
yellowf="${esc}[33m" bluef="${esc}[34m"; purplef="${esc}[35m"
cyanf="${esc}[36m"; whitef="${esc}[37m"
blackb="${esc}[40m"; redb="${esc}[41m"; greenb="${esc}[42m"
yellowb="${esc}[43m" blueb="${esc}[44m"; purpleb="${esc}[45m"
cyanb="${esc}[46m"; whiteb="${esc}[47m"
boldon="${esc}[1m"; boldoff="${esc}[22m"
italicson="${esc}[3m"; italicsoff="${esc}[23m"
ulon="${esc}[4m"; uloff="${esc}[24m"
invon="${esc}[7m"; invoff="${esc}[27m"
reset="${esc}[0m"
}
# note in this first use that switching colors doesn't require a reset
# first - the new color overrides the old one.
initializeANSI
cat << EOF
${redf}▒▒▒▒${reset} ${boldon}${redf}▒▒${reset} ${greenf}▒▒▒▒${reset} ${boldon}${greenf}▒▒${reset} ${yellowf}▒▒▒▒${reset} ${boldon}${yellowf}▒▒${reset} ${bluef}▒▒▒▒${reset} ${boldon}${bluef}▒▒${reset} ${purplef}▒▒▒▒${reset} ${boldon}${purplef}▒▒${reset} ${cyanf}▒▒▒▒${reset} ${boldon}${cyanf}▒▒${reset}
${redf}▒▒ ■${reset} ${boldon}${redf}▒▒${reset} ${greenf}▒▒ ■${reset} ${boldon}${greenf}▒▒${reset} ${yellowf}▒▒ ■${reset} ${boldon}${yellowf}▒▒${reset} ${bluef}▒▒ ■${reset} ${boldon}${bluef}▒▒${reset} ${purplef}▒▒ ■${reset} ${boldon}${purplef}▒▒${reset} ${cyanf}▒▒ ■${reset} ${boldon}${cyanf}▒▒${reset}
${redf}▒▒ ${reset}${boldon}${redf}▒▒▒▒${reset} ${greenf}▒▒ ${reset}${boldon}${greenf}▒▒▒▒${reset} ${yellowf}▒▒ ${reset}${boldon}${yellowf}▒▒▒▒${reset} ${bluef}▒▒ ${reset}${boldon}${bluef}▒▒▒▒${reset} ${purplef}▒▒ ${reset}${boldon}${purplef}▒▒▒▒${reset} ${cyanf}▒▒ ${reset}${boldon}${cyanf}▒▒▒▒${reset}
EOF

BIN
SDL-Test

Binary file not shown.

BIN
VisualBoyAdvance

Binary file not shown.

227
VisualBoyAdvance.cfg

@ -0,0 +1,227 @@ @@ -0,0 +1,227 @@
# All numeric values are in hexadecimal
# Use TAB or EQUAL sign to separate name from value
#
# Key configuration (all numbers are in hexadecimal!)
#
# Keys values are in the format YXXX where Y is the device number. 0 means
# keyborad and XXX is the SDL define for the desired key (read SDL_keysym.h).
#
# If Y is greater than 0, it means joystick number Y-1 and it uses the
# following format for XXX:
#
# - if XXX < 20, XXX is the axis number multiplied by 2. An even number means
# movement to the negative side (on the X axis, it means left). An odd
# number means movement to the positive side (on the X axis, it mean
# right). For the Y axis, negative means up and positive means down.
# X axis is usally axis number 0 and Y is axis number 1.
# - if 20 >= XXX > 30, then XXX is the HAT number multiplied by 4 plus the
# direction: 0 for up, 1 for down, 2 for right and 3 for left. Example:
# 0021 is HAT 0 down, 0026 is HAT 1 right.
# - if 80 >= XXX > 100, XXX is the joystick button number (XXX-080).
#
# Default key configuration is (value in parenthesis):
#
# Left Left Arrow (0114)
# Right Right Arrow (0113)
# Up Up Arrow (0111)
# Down Down Arrow (0112)
# A Z (007a)
# B X (0078)
# L A (0061)
# R S (0073)
# Start ENTER (000d)
# Select BACKSPACE (0008)
# Speed up SPACE (0020)
# Capture F12 (0125)
#
#Joy0_Left=0114
#Joy0_Right=0113
#Joy0_Up=0111
#Joy0_Down=0112
#Joy0_A=0131
#Joy0_B=013f
#Joy0_L=0061
#Joy0_R=0073
#Joy0_Start=000d
#Joy0_Select=012f
#Joy0_Speed=0020
#Joy0_Capture=0125
Joy0_Left=1000
Joy0_Right=1001
Joy0_Up=1002
Joy0_Down=1003
Joy0_A=1080
Joy0_B=1081
Joy0_L=0061
Joy0_R=0073
Joy0_Start=1087
Joy0_Select=1086
Joy0_Speed=1004
Joy0_Capture=0125
# Motion support keys. Same format as above
#
# Default keys are (value in parenthesis):
#
# Left Numeric Pad 4 (0104)
# Right Numeric Pad 6 (0106)
# Up Numeric Pad 8 (0108)
# Down Numeric Pad 2 (0102)
#
Motion_Left=0104
Motion_Right=0106
Motion_Up=0108
Motion_Down=0102
# Frame skip setting. Allowed values are from 0 to 5 only.
frameSkip=2
# Gameboy Frame skip setting. Allowed values are from 0 to 5 only.
gbFrameSkip=0
# Video setting. 0=1x, 1=2x, 2=3x, 3=4x.
video=1
# Use fullscreen mode. 0=false, any other value means true
fullScreen=0
# Disables MMX support
disableMMX=1
# Use bios file. 0=false, any other value means true
useBios=0
# Bios file full path and name (ZIP not supported)
biosFile=none
# Filter to use. 0=no filter, 1=TV Mode, 2=2xSaI, 3=Super 2xSaI, 4=Super Eagle
# 5=Pixelate, 6=Motion Blur, 7=AdvanceMAME Scale2x, 8=Simple 2x,
# 9=Bilinear, A=Bilinear Plus, B=hq2x, C=lq2x
filter=0
# Disable status messages. 0=false, any other value means true
disableStatus=0
# Enable Gameboy border. 0=false, any other value means true
borderOn=0
# Gameboy emulator type. 0=automatic, 1=CGB/GBC, 2=SGB, 3=GB, 4=GBA, 5=SGB2
emulatorType=1
# Enable washed colors. 0=false, any other value means true
colorOption=1
# Directories. Not setting one them makes the file go the rom directory.
# Save state directory
#saveDir=
# Screen shot Capture directory
#captureDir=
# Battery directory
#batteryDir=
# Screen capture format
# 0=PNG, anything else for BMP
captureFormat=0
# Sound quality
# 1=44 Khz, 2=22Khz, 4=11Khz
soundQuality=2
# Sound Echo
# 0=false, anything else for true
soundEcho=0
# Sound Low pass filter
# 0=false, anything else for true
soundLowPass=0
# Sound reverse stereo
# 0=false, anything else for true
soundReverse=0
# Remove GBA intros (not supported anymore)
# 0=false, anything else for true
# removeIntros=0
# Save Type
# 0=automatic, 1=EEPROM, 2=SRAM, 3=Flash, 4=EEPROM+Sensor, 5=NONE
saveType=0
# Flash size
# 0=64K Flash, 1=128K Flash
flashSize=1
# Sound volume
# 0=1x, 1=2x, 2=3x, 3=4x
soundVolume=0
# Interframe blending
# 0=none, 1=motion blur, 2=smart
ifbType=0
# Show emulation speed
# 0=none, 1=percentage, 2=detailed
showSpeed=1
# Show speed in transparent mode
# 0=normal, anything else for transparent
showSpeedTransparent=1
# Enable/Disable auto frameskip
# 0=disable, anything else to enable
autoFrameSkip=0
# Sets the desired throttle
# 0=disable, 5...1000 valid throttle speeds
throttle=200
# Pauses the emulator when the window is inactive
# 0=disable, anything else to enable
pauseWhenInactive=1
# Enables AGBPrint support
# 0=disable, anything else to enable
agbPrint=0
# Enables GBA RTC support
# 0=disable, anything else to enable
rtcEnabled=0
# Sound OFF flag
# 0=sound on, anything else turns off sound
soundOff=1
# Sound Enable
# Controls which channels are enabled: (add values)
# 1 - Channel 1
# 2 - Channel 2
# 4 - Channel 3
# 8 - Channel 4
# 100 - DirectSound A
# 200 - DirectSound B
# 30f=all enabled, 0=mute all
soundEnable=0
# Controls automatic SGB border
# 0=disable, anything else enables automatic SGB border display
borderAutomatic=0
# Skip bios code
# 0=disable, anything else skips BIOS code
skipBios=0
# The interval between the rewind saves
# Minimum of 0 seconds to disable rewind support,
# Maximum of 60 minutes. Value in seconds (hexadecimal numbers)
rewindTimer=0
# Enable enhanced save type detection
# 0=disable, anything else to enable (no longer used)
#enhancedDetection=1

12
alonetraytoggle.sh

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
#!/bin/bash
PROCESS=trayer
number=$(pidof trayer)
if [ $number -gt 0 ]
then
kill $number
else
trayer --edge top --align right --widthtype request --heighttype pixel \
--height 22 --expand true --tint 0x242424 --transparent true \
--alpha 0 &
fi

46
archive

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
#!/usr/bin/env sh
#
# pbrisbin 2013 - compress/extract archives by extension.
#
###
if [ -z "$1" ]; then
printf "usage: archive [ -x ] [ file, ... ]\n" >&2
exit 1
fi
case "$1" in
-x|--extract)
shift
for archive; do
case "$archive" in
*.tbz2|*.tar.bz2) tar xvjf "$archive" ;;
*.tgz|*.tar.gz) tar xvzf "$archive" ;;
*.tar) tar xvf "$archive" ;;
*.gz) gunzip "$archive" ;;
*.bz2) bunzip2 "$archive" ;;
*.zip) unzip "$archive" ;;
*.rar) unrar x "$archive" ;;
*.Z) uncompress "$archive" ;;
*.7z) 7z x "$archive" ;;
*)
printf "%s: unknown extension\n" "$archive" >&2
exit 1
;;
esac
done
;;
*)
target="$1"; shift
case "$target" in
*.tbz2|*.tar.bz2) tar cvpjf "$target" "$@" ;;
*.tgz|*.tar.gz) tar cvpzf "$target" "$@" ;;
*.gz) cat "$@" | gzip > "$target" ;;
*.bz2) cat "$@" | bzip2 > "$target" ;;
*.zip) zip -r "$target" "$@" ;;
*) $0 "$target.tar.gz" "$target" "$@" ;;
esac
;;
esac

10
aur

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
#!/usr/bin/env sh
#
# pbrisbin 2013 - stupid simple, feature-less aur installer.
#
###
packages='https://aur.archlinux.org/packages'
package_url=$(printf "$1" | sed "s%^\(..\).*%$packages/\1/&/&.tar.gz%")
curl -# "$package_url" | tar fxz - &&
(cd "./$1" && makepkg -i -r -s) && rm -rf "./$1"

6
aurxfce.sh

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
#!/usr/bin/env sh
#
# pbrisbin 2013 - open mutt in a new terminal.
#
###
cower -u | wc -l

43
backup

@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
#!/bin/bash
#
# Backup script
#
# Format: YEAR MONTH DAY
DATE=$(date +%Y%m%d)
INCLUDE1="/home/shaggy/.vimrc /home/shaggy/.abook /home/shaggy/.calcurse /home/shaggy/.colors"
INCLUDE2="/home/shaggy/.config/bspwm /home/shaggy/.config/dwb /home/shaggy/.config/htop /home/shaggy/.config/mpd"
INCLUDE3="/home/shaggy/.config/mps-youtube /home/shaggy/.config/mpv /home/shaggy/.config/Mumble /home/shaggy/.config/qutebrowser"
INCLUDE4="/home/shaggy/.config/ranger /home/shaggy/.config/sxhkd /home/shaggy/.config/sxiv /home/shaggy/.config/wmfs"
INCLUDE5="/home/shaggy/.config/youtube-viewer /home/shaggy/.cortex /home/shaggy/.fonts /home/shaggy/.fluxbox"
INCLUDE6="/home/shaggy/.irssi /home/shaggy/.i3 /home/shaggy/.mpv /home/shaggy/.mutt /home/shaggy/.muttrc"
INCLUDE7="/home/shaggy/.nano /home/shaggy/.ncmpcpp /home/shaggy/.newsbeuter /home/shaggy/.offlineimap"
INCLUDE8="/home/shaggy/.ssh /home/shaggy/.themes /home/shaggy/.turses /home/shaggy/.password-store"
INCLUDE9="/home/shaggy/.vim /home/shaggy/.weechat /home/shaggy/scripts /home/shaggy/.aliasrc"
INCLUDE10="/home/shaggy/.cliweather /home/shaggy/.conkyrc /home/shaggy/.gitconfig /home/shaggy/.goobook_cache"
INCLUDE11="/home/shaggy/.msmtprc /home/shaggy/.nanorc /home/shaggy/.netrc /home/shaggy/.offlineimaprc"
INCLUDE12="/home/shaggy/.notmuch-config /home/shaggy/.Xdefaults /home/shaggy/.xinitrc /home/shaggy/.xprofile"
INCLUDE13="/home/shaggy/.zshrc /home/shaggy/.zsh_history /home/shaggy/.screenrc"
INCLUDE14="/home/shaggy/scripts /home/shaggy/private"
BACKUPDIRARCH=/riddlebox/Dropbox/backups/archconfigs/
# Target file
TARTARGET="/riddlebox/Dropbox/backups/backup-$DATE.tar.gz"
TARTARGETMAIL="/riddlebox/Dropbox/backups/backupmail-$DATE.tar.gz"
#tar -czvf $TARTARGET $MYSQLTARGET /home/code/bots /var/config /var/system
tar -czvf $TARTARGETMAIL /home/shaggy/Maildir
tar -czvf $TARTARGET /home/shaggy/bin $INCLUDE1 $INCLUDE2 $INCLUDE3 $INCLUDE4 $INCLUDE5 $INCLUDE6 $INCLUDE7 $INCLUDE8 $INCLUDE9 $INCLUDE10 $INCLUDE11 $INCLUDE12 $INCLUDE13 $INCLUDE14
nice -n 19 rsync --archive --force --delete --progress --compress /etc $BACKUPDIRARCH

7
backup-arch

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
#!/bin/zsh
BACKUPDIR=/riddlebox/Dropbox/backups/
nice -n 19 rsync --archive --force --delete --progress --compress /etc $BACKUPDIR
# rsync --archive --force --delete --progress --compress /usr $BACKUPDIR
#rsync --archive --force --delete --progress --compress /var $BACKUPDIR

16
backupx

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
#!/usr/bin/env sh
#
# pbrisbin 2013 - perform a backup via tarsnap.
#
###
die() { printf "%s\n" "$*" >&2; exit 1; }
[ $UID -eq 0 ] || die 'You must be root'
which tarsnap >/dev/null || die 'You must install tarsnap'
timestamp="$(date +%Y%m%d.%H:%M:%S)"
tarsnap "$@" \
--keyfile /root/tarsnap.key \
--cachedir /usr/local/tarsnap-cache \
-c -f "backup-$timestamp" /root /home /etc /srv

44
barmk.sh

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
#!/bin/sh
#
# dtch - (c) wtfpl 2014
# fetch info and print to stdout
clock () {
date '+%H.%M'
}
volume() {
amixer get PCM | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq
}
cpu() {
LINE=`ps -eo pcpu | grep -vE '^\s*(0.0|%CPU)' | sed -n '1h;$!H;$g;s/\n/ +/gp'`
bc <<< $LINE
}
ram() {
read t f <<< `grep -E 'Mem(Total|Free)' /proc/meminfo | awk '{print $2}'`
bc <<< "scale=2; 100 - $f / $t * 100" | cut -d. -f1
}
#nowplaying() {
# cur=`mpc current`
# test "$1" = "scroll" && PARSER='skroll -n20 -d0.5 -r' || PARSER='cat'
# test -n "$cur" && $PARSER <<< $cur || echo "- stopped -"
#}
music() {
echo -n $(test -z "$(mpc current)" || mpc current -f "%title%")
}
while :; do
buf=""
buf="${buf} MPD: $(music) -"
buf="${buf} VOL: $(volume)%% -"
buf="${buf} CLK: $(clock) -"
buf="${buf} RAM: $(ram)%% -"
buf="${buf} CPU: $(cpu)%%"
echo $buf
sleep 1
done

24
bl

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
#!/usr/bin/env sh
#
# pbrisbin 2014 - adjust backlight brightness. Must be run as root.
#
###
directory=/sys/class/backlight/intel_backlight
cur=$(cat "$directory"/brightness)
max=$(cat "$directory"/max_brightness)
amt=$((max/10))
val=$cur
case "$1" in
u) val=$((cur+amt)) ;;
d) val=$((cur-amt)) ;;
m) val=$max ;;
*) { printf "usage: bl [u|d|m]\n" >&2; exit 64; } ;;
esac
# Bounds check
[ $val -gt $max ] && val=$max
[ $val -lt 0 ] && val=0
echo $val > "$directory"/brightness

20
burn

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
#!/usr/bin/env sh
#
# pbrisbin 2013 - burn an ISO to CD/DVD.
#
###
device=/dev/sr0
case $1 in
-h|--help)
printf "usage: burn [-c] <file.iso>\n"
exit
;;
-c|--cd)
shift
cdrecord -v speed=48 dev=$device "$1"
;;
*)
growisofs -dvd-compat -Z $device="$1"
;;
esac

18
cabal-up

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
#!/bin/sh
#
# pbrisbin 2014 - install "system" Haskell packages.
#
###
set -e
if [ "$1" = 'clear' ]; then
rm -fr \
~/.ghc \
~/.cabal/bin/* \
~/.cabal/packages/*/* \
fi
cd # avoid accidental sandbox installation
cabal update
cabal install cabal-install --avoid-reinstalls
cabal install hi msu pandoc xmonad xmonad-contrib --avoid-reinstalls

10
calc

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
#!/usr/bin/env sh
#
# pbrisbin 2013 - perform simple math via bc or awk.
#
###
if which bc &>/dev/null; then
printf "scale=10; %s\n" "$*" | bc -l
else
printf "BEGIN { print %s }\n" "$*" | awk -f -
fi

7
chat

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
#!/usr/bin/env sh
#
# pbrisbin 2013 - open my remote chat session in a new terminal.
#
###
urxvtc -title chat -n chat -e \
ssh -t pbrisbin.com "bash -ilc 'screen -R -D -S irc weechat'"

1
clireddit

@ -0,0 +1 @@ @@ -0,0 +1 @@
Subproject commit fb8de089ebdcc619edf3b22b991f4b020200a815

137
cliweather

@ -0,0 +1,137 @@ @@ -0,0 +1,137 @@
#!/usr/bin/env python2
from xml.dom.minidom import parseString
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
from sys import argv, exit, stderr, stdout
import os.path
import datetime
VERSION = '.01'
URL = 'http://www.aaronfoltz.com'
YAHOO_API_KEY = 'dj0yJmk9TEdTT09FNVp6MWlhJmQ9WVdrOVpsaGhVbEZTTmpJbWNHbzlOalUyT0RNMk1qWXkmcz1jb25zdW1lcnNlY3JldCZ4PTkw'
WOEID_URL = 'http://where.yahooapis.com/v1/places.q({0})?'
YAHOO_API_URL = 'http://weather.yahooapis.com/forecastrss?'
def main():
try:
# Forecast option
if "-f" in argv[1]:
# See if there is a zip with the argument
try:
place = argv[2]
getForecast(place)
# If no zip is provided, get it from the geolocation service
except IndexError:
place = getPlace()
getForecast(place)
# Else there isn't an option there, it must be a zip code if anything
else:
try:
place = argv[1]
getCurrent(place)
# No arguments are provided, get the place from the geolocation service
except IndexError:
place = getPlace()
getCurrent(place)
except IndexError:
place = getPlace()
getCurrent(place)
def getCurrent(place):
woeid = getWOEID(place)
# Call to get the weather
api = YAHOO_API_URL + urlencode({'w': woeid})
dom = parseString(urlopen(api).read())
# Get the necessary DOM elements
location = dom.getElementsByTagName('yweather:location')[0]
currentConditions = dom.getElementsByTagName('yweather:condition')[0]
atmosphere = dom.getElementsByTagName('yweather:atmosphere')[0]
wind = dom.getElementsByTagName('yweather:wind')[0]
print
print('Location: %s, %s' % (location.getAttribute("city"), location.getAttribute("region")))
print('Condition: %s' % currentConditions.getAttribute("text"))
print('Temperature: %sF/%sC' % (currentConditions.getAttribute("temp"), fahToCel(currentConditions.getAttribute("temp"))))
print('Humidity: %s' % atmosphere.getAttribute('humidity') + "%")
print('Wind: %s mph %s' % (wind.getAttribute("speed"), degToCompass(wind.getAttribute("direction"))))
def getForecast(place):
woeid = getWOEID(place)
# Call to get the weather
api = YAHOO_API_URL + urlencode({'w': woeid})
dom = parseString(urlopen(api).read())
# Get the necessary DOM elements
forecasts = dom.getElementsByTagName('yweather:forecast')
print
# Print info for each forecast day
for day in forecasts:
print('Day: %s' % datetime.datetime.strptime(day.getAttribute('date'), '%d %b %Y').strftime('%A, %B %d, %Y'))
print('\tHigh: %sF/%sC' % (day.getAttribute("high"), fahToCel(day.getAttribute("high"))))
print('\tLow: %sF/%sC' % (day.getAttribute("low"), fahToCel(day.getAttribute("low"))))
print('\tCondition: %s' % day.getAttribute('text'))
# Retrives zip code if not entered
def getPlace():
import re
path = "%s/.cliweather" % os.getenv("HOME")
if os.path.exists(path):
try:
f = open(path, 'r')
return f.read()
except:
print "Could not load .cliweather"
# Get the geoip information
geoip = urlopen('http://api.ipinfodb.com/v3/ip-city/?key=29e619f84fd83f32c4987573a4ccc11fd59b268234aa50c1289230f1fff0dbd2').read()
# The returned value is perfectly fine
if re.match("OK;;", geoip):
# regex to get the zip code
expression = "OK;;([^;]+;){5}(\w+)"
result = re.search(expression, geoip)
# return the zip code from the returned data
return result.group(2)
# Make a call to Yahoo's API to get the WOEID given a zip code
def getWOEID(place):
# Make the call to the API to return the XML with WOEID
api = (WOEID_URL + urlencode({'appid': YAHOO_API_KEY})).format(place)
dom = parseString(urlopen(api).read())
# Return parsed WOEID
return dom.getElementsByTagName('woeid')[0].firstChild.data
# Convert Fah to Cel
def fahToCel(value):
return '{0:.0f}'.format((100.0/(212-32)) * (int(value) - 32))
# From http://stackoverflow.com/questions/7490660/converting-wind-direction-in-angles-to-text-words
def degToCompass(num):
num = int(num)
val=int((num / 22.5) + .5)
arr=["N","NNE","NE","ENE","E","ESE", "SE", "SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"]
return arr[(val % 16)]
if __name__ == "__main__":
main()

22
conkydzen.sh

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
#!/bin/sh
#echo "{\"version\":1}"
#echo "[[] ,"
echo "{\"version\": 1}"
echo "["
echo "[]"
FG='#FFF'
BG='#1c1c23'
FONT='-*-ProFont-*-*-*-*-11-*-*-*-*-*-*-*'
#conky -c ~/.i3/conkydzen | dzen2 -fg $FG -bg $BG -fn $FONT -x 500 -y 2 -w 3000 -ta r -xs 1
conky | dzen2 -x '500' -e '' -fg '#CCCACA' -bg '#242424' -ta r -fn '-*-dejavu sans-*-r-normal-*-13-120-*-*-*-*-iso8859-*' -y 0 -h 20 -p
#conky -c ~/bin/conkyi3bar.sh | dzen2 -fg $FG -bg $BG -fn $FONT -x 500 -y 2 -w 3000 -ta r -xs 1
#conky -c ~/bin/conkyi3bar.sh | dzen2 -x '500' -e '' -fg '#CCCACA' -bg '#242424' -ta r -fn '-*-inconsolata-*-r-normal-*-12-120-*-*-*-*-iso8859-*' -y 0 -h 20 -p
#conky -c /riddlebox/Downloads/conkytest | dzen2 -x '500' -e '' -fg '#CCCACA' -bg '#242424' -ta r -fn '-*-inconsolata-*-r-normal-*-12-120-*-*-*-*-iso8859-*' -y 0 -h 20 -p &
exit 0

51
conkyi3bar.sh

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
## Conky config i3; dkeg; 2013 ##
out_to_x no
own_window no
out_to_console yes
background no
max_text_width 0
update_interval 3.0
total_run_times 0
short_units yes
if_up_strictness address
#use_spacer left
override_utf8_locale no
# set to 1 to disable averaging
cpu_avg_samples 4
border_inner_margin 0
border_outer_margin 0
#old color
#28c3c5
TEXT
[
{"full_text":"mail","color":"\#888888","separator":false,"separator_block_width":3},\
{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\
{"full_text":"${execpi 60 python ~/bin/gmail.py}","color":${if_match ${execpi 60 python ~/bin/gmail.py}>1}"\#cc5555"${else}"\#eeeeee"${endif},"separator":false,"separator_block_width":10 },\
\
{"full_text":"hd","color":"\#888888","separator":false,"separator_block_width":3},\
{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\
{"full_text":"${fs_free /home}","color":"\#eeeeee","separator":false,"separator_block_width":10},\
\
{"full_text":"ram","color":"\#888888","separator":false,"separator_block_width":3},\
{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\
{"full_text":"${memperc}%","color":${if_match ${memperc}>20}"\#cc5555"${else}"\#eeeeee"${endif},"separator":false,"separator_block_width":10 },\
\
{"full_text":"cpu","color":"\#888888","separator":false,"separator_block_width":3},\
{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\
{"full_text":"${cpu}%","color":${if_match ${cpu}>10}"\#cc5555"${else}"\#eeeeee"${endif},"separator":false,"separator_block_width":10},\
\
{"full_text":"bat","color":"\#888888","separator":false,"separator_block_width":3},\
{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\
{"full_text":"${memperc}","color":"\#eeeeee","separator":false,"separator_block_width":10},\
\
{"full_text":"net","color":"\#888888","separator":false,"separator_block_width":3},\
{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\
{"full_text":"${if_up wlan0}w ${wireless_bitrate wlan0}${else}${if_up eth0}e ${upspeedf eth0} up ${downspeedf eth0} dwn${else}{null}${endif}${endif}","color":"\#eeeeee","separator":false,"separator_block_width":10},\
{"full_text":"»","color":"\#FFFFFF","separator":false,"separator_block_width":10},\
\
{"full_text":"${time %a %d.%m}","color":"\#eeeeee","separator":false,"separator_block_width":10},\
{"full_text":"${time %H:%M} ","color":"\#eeeeee"}\
],

28
cpu

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
#!/bin/sh
#
# z3bra - (c) wtfpl 2014
usage () {
cat <<EOF
usage: $(basename $0) [-hp]
-h : print help
-p : percentage of cpu used (default)
-n : number of running processes
EOF
}
cpuperc () {
LINE=`ps -eo pcpu |grep -vE '^\s*(0.0|%CPU)' |sed -n '1h;$!H;$g;s/\n/ +/gp'`
echo "`echo $LINE | bc`%"
}
cpunumb() {
ls /proc | grep -oE '^[0-9]*$' | wc -w
}
case $1 in
-h) usage;;
-n) cpunumb;;
*) cpuperc;;
esac

BIN
cpubar

Binary file not shown.

135
cpubar.c

@ -0,0 +1,135 @@ @@ -0,0 +1,135 @@
/* cpubar - ascii cpu usage bar, best used with dzen
*
* Copyright (C) 2007 by Robert Manea, <rob dot manea at gmail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* What you look for is \r it is Carriage Return.
* Makes the carriage go back to the beginning of the line.
* Or use \n as it will go down one line.
*
* Compile it with:
* gcc cpubar.c -o cpubar
*
*/
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
void pbar (double, int, char);
struct cpu_info {
unsigned long long user;
unsigned long long system;
unsigned long long idle;
unsigned long long iowait;
} ncpu, ocpu;
void
pbar(double perc, int maxc, char sym) {
int i, rp;
double l;
l = perc * ((double)maxc / 100);
if( (int)(perc + 0.5) >= (int)perc)
rp = (int)(perc + 0.5);
else
rp = (int)perc;
printf("CPU: %3d%% [", rp);
for(i=0; i < (int)l; i++)
printf("%c", sym);
for(; i < maxc; i++)
printf(" ");
printf("]\r");
fflush(stdout);
}
int
main(int argc, char *argv[])
{
int i;
double total;
struct cpu_info mcpu;
FILE *statfp;
char buf[256];
/* defaults */
int maxchars=25;
int ival=1;
char psym='=';
for(i=1; i < argc; i++) {
if(!strncmp(argv[i], "-c", 3)) {
if(++i < argc)
maxchars = atoi(argv[i]);
}
else if(!strncmp(argv[i], "-s", 3)) {
if(++i < argc)
psym = argv[i][0];
}
else if(!strncmp(argv[i], "-i", 3)) {
if(++i < argc)
ival = atoi(argv[i]);
}
else {
printf("usage: cpubar [-c <charcount>] [-s <symbol>] [-i <interval>]\n");
return EXIT_FAILURE;
}
}
if(!(statfp = fopen("/proc/stat", "r"))) {
printf("cpubar: error opening '/proc/stat'\n");
return EXIT_FAILURE;
}
while(1) {
rewind(statfp);
while(fgets(buf, sizeof buf, statfp)) {
if(!strncmp(buf, "cpu ", 4)) {
unsigned long long unice;
double myload;
/* linux >= 2.6 */
if((sscanf(buf, "cpu %llu %llu %llu %llu %llu",
&ncpu.user, &unice, &ncpu.system, &ncpu.idle, &ncpu.iowait)) < 5) {
printf("cpubar: wrong field count in /proc/stat\n");
return EXIT_FAILURE;
}
ncpu.user += unice;
mcpu.user = ncpu.user - ocpu.user;
mcpu.system = ncpu.system - ocpu.system;
mcpu.idle = ncpu.idle - ocpu.idle;
mcpu.iowait = ncpu.iowait - ocpu.iowait;
total = (mcpu.user + mcpu.system + mcpu.idle + mcpu.iowait) / 100.0;
myload = (mcpu.user + mcpu.system + mcpu.iowait) / total;
pbar(myload, maxchars, psym);
ocpu = ncpu;
}
}
sleep(ival);
}
return EXIT_SUCCESS;
}

BIN
dbar

Binary file not shown.

198
dbar.c

@ -0,0 +1,198 @@ @@ -0,0 +1,198 @@
/* dbar - ascii percentage meter
*
* Copyright (C) 2007 by Robert Manea, <rob dot manea at gmail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Compile with:
* gcc dbar.c -o dbar
*
*/
/*
dbar lets you define static 0% and 100% marks or you can define these
marks dynamically at runtime. Static and dynamic marks can be mixed,
in this case the value specified at runtime will have a higher priority.
You can specify ranges of numbers, negative, positive or ranges with a
negative min value and positive max value.
All numbers are treated as double precision floating point, i.e. the
input is NOT limited to integers.
Options:
-max : Value to be considered 100% (default: 100)
-min : Value to be considered 0% (default: 0 )
-w : Number of charcaters to be
considered 100% in the meter (default: 25 )
-s : Symbol represeting the
percentage value in the meter (default: = )
-l : label to be prepended to
the bar (default: '' )
-nonl: no new line, don't put
'\n' at the end of the bar (default: do print '\n')
Usage examples:
1) Static 100% mark or single value input:
echo 25 | dbar -m 100 -l Sometext
Output: Sometext 25% [====== ]
2) If your 100% mark changes dynamically or 2-values input:
echo "50 150" | dbar
^ ^
| |__ max. value
|
|__ value to display
Output: 33% [======== ]
3) If your value range is not between [0, maxval] or 3-values input:
echo "50 -25 150" | dbar
^ ^ ^
| | |__ max. value 100% mark
| |
| |_____ min. value 0% mark
|
|________ value to display
Output: 43% [=========== ]
4) Multiple runs:
for i in 2 20 50 75 80; do echo $i; sleep 1; done | dbar | dzen2
Output: Find out yourself.
*/
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
#define MAXLEN 512
static void pbar (const char*, double, int, char, int);
static void
pbar(const char* label, double perc, int maxc, char sym, int pnl) {
int i, rp;
double l;
l = perc * ((double)maxc / 100);
if((int)(l + 0.5) >= (int)l)
l = l + 0.5;
if((int)(perc + 0.5) >= (int)perc)
rp = (int)(perc + 0.5);
else
rp = (int)perc;
if(label)
printf("%s %3d%% [", label, rp);
else
printf("%3d%% [", rp);
for(i=0; i < (int)l; i++)
if(i == maxc) {
putchar('>');
break;
} else
putchar(sym);
for(; i < maxc; i++)
putchar(' ');
printf("]%s", pnl ? "\n" : "");
fflush(stdout);
}
int
main(int argc, char *argv[])
{
int i, nv;
double val;
char aval[MAXLEN], *endptr;
/* defaults */
int maxchars = 25;
double minval = 0;
double maxval = 100.0;
char psym = '=';
int print_nl = 1;
const char *label = NULL;
for(i=1; i < argc; i++) {
if(!strncmp(argv[i], "-w", 3)) {
if(++i < argc)
maxchars = atoi(argv[i]);
}
else if(!strncmp(argv[i], "-s", 3)) {
if(++i < argc)
psym = argv[i][0];
}
else if(!strncmp(argv[i], "-max", 5)) {
if(++i < argc) {
maxval = strtod(argv[i], &endptr);
if(*endptr) {
fprintf(stderr, "dbar: '%s' incorrect number format", argv[i]);
return EXIT_FAILURE;
}
}
}
else if(!strncmp(argv[i], "-min", 5)) {
if(++i < argc) {
minval = strtod(argv[i], &endptr);
if(*endptr) {
fprintf(stderr, "dbar: '%s' incorrect number format", argv[i]);
return EXIT_FAILURE;
}
}
}
else if(!strncmp(argv[i], "-l", 3)) {
if(++i < argc)
label = argv[i];
}
else if(!strncmp(argv[i], "-nonl", 6)) {
print_nl = 0;
}
else {
fprintf(stderr, "usage: dbar [-w <characters>] [-s <symbol>] [-min <minvalue>] [-max <maxvalue>] [-l <string>] [-nonl]\n");
return EXIT_FAILURE;
}
}
while(fgets(aval, MAXLEN, stdin)) {
nv = sscanf(aval, "%lf %lf %lf", &val, &minval, &maxval);
if(nv == 2) {
maxval = minval;
minval = 0;
}
pbar(label, (100*(val-minval))/(maxval-minval), maxchars, psym, print_nl);
}
return EXIT_SUCCESS;
}

6
dirmailcheck.sh

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
#!/bin/bash
# Set maildirs
maildirs="$HOME/Maildir/*/INBOX/new/"
find $maildirs -type f | wc -l
exit 0

46
dna.sh

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
#!/bin/bash
#
# ANSI color scheme script by pfh
#
# Initializing mod by lolilolicon from Archlinux
#
f=3 b=4
for j in f b; do
for i in {0..7}; do
printf -v $j$i %b "\e[${!j}${i}m"
done
done
bld=$'\e[1m'
rst=$'\e[0m'
inv=$'\e[7m'
cat << EOF
${f1} █-----${bld}${rst}${f2} █-----${bld}${rst} ${f3} █-----${bld}${rst} ${f4} █-----${bld}${rst} ${f5} █-----${bld}${rst} ${f6} █-----${bld}${rst}
${f1} █---${bld}${rst} ${f2} █---${bld}${rst} ${f3} █---${bld}${rst} ${f4} █---${bld}${rst} ${f5} █---${bld}${rst} ${f6} █---${bld}${rst}
${f1} █-${bld}${rst} ${f2} █-${bld}${rst} ${f3} █-${bld}${rst} ${f4} █-${bld}${rst} ${f5} █-${bld}${rst} ${f6} █-${bld}${rst}
${f1}${rst} ${f2}${rst} ${f3}${rst} ${f4}${rst} ${f5}${rst} ${f6}${rst}
${f1}${bld} █-${rst}${f1}${rst} ${f2}${bld} █_${rst}${f2}${rst} ${f3}${bld} █-${rst}${f3}${rst} ${f4}${bld} █-${rst}${f4}${rst} ${f5}${bld} █-${rst}${f5}${rst} ${f6}${bld} █-${rst}${f6}${rst}
${f1}${bld} █---${rst}${f1}${rst} ${f2}${bld} █---${rst}${f2}${rst} ${f3}${bld} █---${rst}${f3}${rst} ${f4}${bld} █---${rst}${f4}${rst} ${f5}${bld} █---${rst}${f5}${rst} ${f6}${bld} █---${rst}${f6}${rst}
${f1}${bld} █-----${rst}${f1}${rst} ${f2}${bld} █-----${rst}${f2}${rst} ${f3}${bld} █-----${rst}${f3}${rst} ${f4}${bld} █-----${rst}${f4}${rst} ${f5}${bld} █-----${rst}${f5}${rst} ${f6}${bld} █-----${rst}${f6}${rst}
${f1}${bld} █---${rst}${f1}${rst} ${f2}${bld} █---${rst}${f2}${rst} ${f3}${bld} █---${rst}${f3}${rst} ${f4}${bld} █---${rst}${f4}${rst} ${f5}${bld} █---${rst}${f5}${rst} ${f6}${bld} █---${rst}${f6}${rst}
${f1}${bld} █-${rst}${f1}${rst} ${f2}${bld} █-${rst}${f2}${rst} ${f3}${bld} █-${rst}${f3}${rst} ${f4}${bld} █-${rst}${f4}${rst} ${f5}${bld} █-${rst}${f5}${rst} ${f6}${bld} █-${rst}${f6}${rst}
${f1}${bld}${rst} ${f2}${bld}${rst} ${f3}${bld}${rst} ${f4}${bld}${rst} ${f5}${bld}${rst} ${f6}${bld}${rst}
${f1} █-${bld}${rst} ${f2} █-${bld}${rst} ${f3} █-${bld}${rst} ${f4} █-${bld}${rst} ${f5} █-${bld}${rst} ${f6} █-${bld}${rst}
${f1} █---${bld}${rst} ${f2} █---${bld}${rst} ${f3} █---${bld}${rst} ${f4} █---${bld}${rst} ${f5} █---${bld}${rst} ${f6} █---${bld}${rst}
${f1} █-----${bld}${rst}${f2} █-----${bld}${rst} ${f3} █-----${bld}${rst} ${f4} █-----${bld}${rst} ${f5} █-----${bld}${rst} ${f6} █-----${bld}${rst}
${f1} █---${bld}${rst} ${f2} █---${bld}${rst} ${f3} █---${bld}${rst} ${f4} █---${bld}${rst} ${f5} █---${bld}${rst} ${f6} █---${bld}${rst}
${f1} █-${bld}${rst} ${f2} █-${bld}${rst} ${f3} █-${bld}${rst} ${f4} █-${bld}${rst} ${f5} █-${bld}${rst} ${f6} █-${bld}${rst}
${f1}${rst} ${f2}${rst} ${f3}${rst} ${f4}${rst} ${f5}${rst} ${f6}${rst}
${f1}${bld} █-${rst}${f1}${rst} ${f2}${bld} █_${rst}${f2}${rst} ${f3}${bld} █-${rst}${f3}${rst} ${f4}${bld} █-${rst}${f4}${rst} ${f5}${bld} █-${rst}${f5}${rst} ${f6}${bld} █-${rst}${f6}${rst}
${f1}${bld} █---${rst}${f1}${rst} ${f2}${bld} █---${rst}${f2}${rst} ${f3}${bld} █---${rst}${f3}${rst} ${f4}${bld} █---${rst}${f4}${rst} ${f5}${bld} █---${rst}${f5}${rst} ${f6}${bld} █---${rst}${f6}${rst}
${f1}${bld} █-----${rst}${f1}${rst} ${f2}${bld} █-----${rst}${f2}${rst} ${f3}${bld} █-----${rst}${f3}${rst} ${f4}${bld} █-----${rst}${f4}${rst} ${f5}${bld} █-----${rst}${f5}${rst} ${f6}${bld} █-----${rst}${f6}${rst}
${f1}${bld} █---${rst}${f1}${rst} ${f2}${bld} █---${rst}${f2}${rst} ${f3}${bld} █---${rst}${f3}${rst} ${f4}${bld} █---${rst}${f4}${rst} ${f5}${bld} █---${rst}${f5}${rst} ${f6}${bld} █---${rst}${f6}${rst}
${f1}${bld} █-${rst}${f1}${rst} ${f2}${bld} █-${rst}${f2}${rst} ${f3}${bld} █-${rst}${f3}${rst} ${f4}${bld} █-${rst}${f4}${rst} ${f5}${bld} █-${rst}${f5}${rst} ${f6}${bld} █-${rst}${f6}${rst}
${f1}${bld}${rst} ${f2}${bld}${rst} ${f3}${bld}${rst} ${f4}${bld}${rst} ${f5}${bld}${rst} ${f6}${bld}${rst}
${f1} █-${bld}${rst} ${f2} █-${bld}${rst} ${f3} █-${bld}${rst} ${f4} █-${bld}${rst} ${f5} █-${bld}${rst} ${f6} █-${bld}${rst}
${f1} █---${bld}${rst} ${f2} █---${bld}${rst} ${f3} █---${bld}${rst} ${f4} █---${bld}${rst} ${f5} █---${bld}${rst} ${f6} █---${bld}${rst}
${f1} █-----${bld}${rst}${f2} █-----${bld}${rst} ${f3} █-----${bld}${rst} ${f4} █-----${bld}${rst} ${f5} █-----${bld}${rst} ${f6} █-----${bld}${rst}
EOF

22
dropboxdoom

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
#!/bin/bash
STATUS=$(dropbox status)
if [ "$STATUS" == "Dropbox isn't running!" ]; then
START=$(dropbox start)
fi
COUNT_DONE=1
while true
do
STATUS=$(dropbox status)
if [ "$STATUS" == "Up to date" ]; then
COUNT_DONE=`expr $COUNT_DONE + 1`
if [ $COUNT_DONE -gt 10 ]
then
STOP=$(dropbox stop)
break;
fi
fi
done
exit 0

15
dzen_calendar.sh

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
#!/bin/bash
#
# pop-up calendar for dzen
# (c) 2007, by Robert Maneaq
# mods 2012, by arpinux
TODAY=$(expr `date +'%d'` + 0)
MONTH=`date +'%m'`
YEAR=`date +'%Y'`
(echo '^fg(green)'`date +'%A, %H:%M'`; \
echo ' day:'`date +'%j'`' - week:'`date +'%U'`; \
echo; cal | sed -re "s/(^|[ ])($TODAY)($|[ ])/\1^fg(red)\2^fg()^bg()\3/"; \
[ $MONTH -eq 12 ] && YEAR=`expr $YEAR + 1`; cal `expr \( $MONTH + 1 \) % 12` $YEAR; \
sleep 60) | dzen2 -fn '-*-terminus-*-*-*-*-12-*-*-*-*-*-iso10646-*' -x 760 -y 20 -h 14 -w 125 -l 18 -e 'onstart=uncollapse;button1=togglecollapse;button3=exit'

6
filemanager

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
#!/usr/bin/env sh
#
# pbrisbin 2013 - open mutt in a new terminal.
#
###
urxvtc -title filemanager -n filemanager -e ranger

136
gcontacts

@ -0,0 +1,136 @@ @@ -0,0 +1,136 @@
#!/usr/bin/python2
#
# pbrisbin 2014 - access Google Contacts for mutt's query_command.
#
# Originally script by Jim Karsten <jimkarsten@gmail.com>. Modified by Pat
# Brisbin <pbrisbin@gmail.com> to do a lot less and handle arguments
# differently.
#
# Usage:
#
# gcontacts <account> <password-command> <keyword>, ...
#
# Example Mutt Usage:
#
# set query_command = "echo; gcontacts foo@gmail.com 'echo SuperSecret' '%s'"
#
###
import re
import sys
import subprocess
import gdata.contacts
import gdata.contacts.service
P_REL = re.compile(r'^http://schemas.google.com/g/2005#(.*)$')
class Contacts():
def __init__(self, gd_client):
self.gd_client = gd_client
self.query = gdata.contacts.service.ContactsQuery()
self.query.max_results = 999999
self.feed = gd_client.GetContactsFeed(self.query.ToUri())
self.contacts = []
self.filtered_contacts = []
def get(self):
for entry in self.feed.entry:
contact = Contact(entry)
self.contacts.append(contact)
def filter(self, keyword):
for contact in self.contacts:
if contact.is_match(keyword=keyword):
self.filtered_contacts.append(contact)
def print_contacts(self):
printable_item = []
for contact in self.filtered_contacts:
emails = contact.emails
if not emails:
emails = [{'address': 'n/a', 'rel':'n/a'}]
for email_addr in emails:
sortable_name = contact.name or contact.organization or ''
c = {'email': email_addr['address'], 'name': sortable_name,
'other_info': email_addr['rel'], 'contact': contact}
printable_item.append(c)
cmp_fn = lambda x, y: cmp(x['name'].lower(), y['name'].lower())
for count, printable in enumerate(sorted(printable_item, cmp=cmp_fn)):
contact = printable['contact']
print "{email}\t{name}\t{info}".format(
email=printable['email'], name=contact.fullname,
info=printable['other_info'])
class Contact():
def __init__(self, entry):
self.entry = entry
self.name = self.entry.title.text or None
self.organization = None
if self.entry.organization and self.entry.organization.org_name:
self.organization = self.entry.organization.org_name.text or None
self.parse_emails()
self.set_fullname()
def is_match(self, keyword):
match = False
for email_addr in self.emails:
if re.search(keyword, email_addr['address'], re.IGNORECASE):
match = True
if self.name:
if re.search(keyword, self.name, re.IGNORECASE):
match = True
if self.organization:
if re.search(keyword, self.organization, re.IGNORECASE):
match = True
return match
def parse_emails(self):
self.emails = []
for email_addr in self.entry.email:
rel = 'other'
if email_addr.rel:
match = P_REL.match(email_addr.rel)
if match:
rel = match.group(1)
self.emails.append({'address': email_addr.address, 'rel': rel})
def set_fullname(self):
if self.name and self.organization:
self.fullname = "{name} ({org})".format(name=self.name,
org=self.organization)
elif self.organization:
self.fullname = "{org}".format(org=self.organization)
elif self.name:
self.fullname = "{name}".format(name=self.name)
else:
self.fullname = 'n/a'
if __name__ == '__main__':
if len(sys.argv) < 4:
print >> sys.stderr, "usage: gcontacts <email> <password-command> <keyword>, ..."
quit(64)
email, command = sys.argv[1:3]
keyword = ' '.join(sys.argv[3:])
password = subprocess.check_output(command.split(' '))
gd_client = gdata.contacts.service.ContactsService()
gd_client.email = email
gd_client.password = password
gd_client.source = 'dm-contacts-1'
gd_client.ProgrammaticLogin()
contact_set = Contacts(gd_client)
contact_set.get()
contact_set.filter(keyword)
contact_set.print_contacts()

19
gensetup

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
#!/usr/bin/env bash
#
# pbrisbin 2013 - generates and outputs a script which, when run, would
# install all packages currently installed on the system. This, combined
# with a restoration of /etc and /home, should constitute an acceptable
# system recovery.
#
###
cat << EOF
#!/usr/bin/env sh
echo '$(pacman -Qqe | grep -v "$(pacman -Qqm)")' | sudo pacman -Syu --needed -
curl 'https://aur.archlinux.org/packages/au/aurget/aurget.tar.gz' | tar fxz - \\
&& (cd ./aurget && makepkg -i) && rm -r ./aurget
echo '$(pacman -Qqem)' | xargs /bin/aurget -S
EOF

53
getnetrc

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
#!/usr/bin/env python
#
# pbrisbin 2013 - retreive passwords by email address from ~/.netrc.
# Unlike typical netrc usage, this allows you to store credentials under
# the domain of the email address, rather than the hostname of the IMAP
# server (which may be the same for multiple sets of credentials).
#
# Example ~/.netrc:
#
# machine gmail.com
# login pbrisbin@gmail.com
# password supersecret
#
# machine thoughtbot.com
# login pat@thoughtbot.com
# password othersecret
#
# Usage:
#
# $ getnetrc pbrisbin@gmail.com
# supersecret
#
# $ getnetrc pat@thoughtbot.com
# othersecret
#
###
import netrc
import sys
def get_password(email_address):
try:
net_rc = netrc.netrc()
except IOError:
return None
try:
domain = email_address.split('@', 2)[1]
except:
return None
for host in net_rc.hosts.keys():
if host == domain:
login, _, password = net_rc.authenticators(host)
if login == email_address:
return password
return None
if __name__ == '__main__':
pw = get_password(sys.argv[1])
if pw: print(pw)

12
gh-read

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
#!/bin/sh
#
# pbrisbin 2014 - details:
#
# - http://blog.adamspiers.org/2014/10/05/managing-your-github-notifications-inbox-with-mutt/
# - https://github.com/aspiers/mutt.pub/blob/master/bin/read-github-notification
#
###
beacon_re='https://github\.com/notifications/beacon/.*\.gif'
beacon_url="$(tr -d '\n' | grep -o "$beacon_re")"
[ -n "$beacon_url" ] && curl --silent "$beacon_url" >/dev/null &

22
gifcast

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
#!/usr/bin/env sh
#
# pbrisbin 2013 - record screen area as a gif. Requires ffcast (for
# xrectsel) and byzanz (for the actual recording).
#