diff options
-rwxr-xr-x | cdrecord (renamed from grava) | 11 | ||||
-rwxr-xr-x | chroot-chromium-browser | 1 | ||||
-rwxr-xr-x | chroot-upgrade | 2 | ||||
-rwxr-xr-x | commit | 2 | ||||
-rwxr-xr-x | gpg-agent-eval | 2 | ||||
-rwxr-xr-x | misc/annex-fsck | 9 | ||||
-rwxr-xr-x | misc/convert-gitosis-conf | 127 | ||||
-rwxr-xr-x | misc/email/checkmail (renamed from misc/email/checkmail.sh) | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | misc/email/vcard-filter | 0 | ||||
-rwxr-xr-x | misc/eterm-trans | 2 | ||||
-rwxr-xr-x | misc/firefox-rotate | 21 | ||||
-rwxr-xr-x | misc/freeshell | 5 | ||||
-rwxr-xr-x | misc/google | 17 | ||||
-rwxr-xr-x | misc/mount-tablet | 21 | ||||
-rwxr-xr-x | misc/noisecd | 59 | ||||
-rwxr-xr-x[-rw-r--r--] | misc/parse-remind (renamed from misc/parse_remind.pl) | 0 | ||||
-rwxr-xr-x | misc/ps_mem.py | 240 | ||||
-rwxr-xr-x | misc/scan | 1 | ||||
-rwxr-xr-x | misc/shell | 2 | ||||
-rwxr-xr-x | misc/snownews | 1 | ||||
-rwxr-xr-x | misc/splash.sh | 7 | ||||
-rwxr-xr-x | misc/term-color | 43 | ||||
l--------- | misc/umount-tablet | 1 | ||||
-rwxr-xr-x | misc/wifi | 2 | ||||
-rwxr-xr-x | misc/xbitchx | 20 | ||||
-rwxr-xr-x | misc/xcamp | 17 | ||||
-rwxr-xr-x | misc/xfeast | 15 | ||||
-rwxr-xr-x | misc/xgkrellm | 7 | ||||
-rwxr-xr-x | misc/xterm | 1 | ||||
-rwxr-xr-x | philter.py | 2 | ||||
-rwxr-xr-x | philter.sh | 4 | ||||
-rwxr-xr-x | refresh-keys | 2 | ||||
-rwxr-xr-x | ssh-agent-eval | 2 | ||||
-rwxr-xr-x | ssl | 4 | ||||
-rwxr-xr-x | ssl-cert-check | 705 | ||||
-rwxr-xr-x | start-streaming | 15 | ||||
-rwxr-xr-x | terminal | 2 | ||||
-rwxr-xr-x | timelog | 2 | ||||
-rwxr-xr-x | tor-browser | 4 | ||||
-rwxr-xr-x | wscreen | 2 | ||||
-rwxr-xr-x | xconky | 2 | ||||
-rwxr-xr-x | xhibernate | 4 | ||||
-rwxr-xr-x | xirssi | 16 | ||||
-rwxr-xr-x | xlock | 5 | ||||
-rwxr-xr-x | xmutt | 16 | ||||
-rwxr-xr-x | xsuspend | 4 |
46 files changed, 67 insertions, 1367 deletions
@@ -1,8 +1,13 @@ #!/bin/bash # -# record an audio cd based on current folder wav files +# Record an audio cd based on wav files in a folder # +if [ -z "$1" ] && [ -d "$1" ]; then + CWD="`pwd`" + cd $1 +fi + echo CD_DA > toc for file in *.wav; do @@ -12,3 +17,7 @@ for file in *.wav; do done cdrdao write --speed 8x --device /dev/cdrom1 toc + +if [ ! -z "$CWD" ]; then + cd $CWD +fi diff --git a/chroot-chromium-browser b/chroot-chromium-browser index 6a20341..63ffbf5 100755 --- a/chroot-chromium-browser +++ b/chroot-chromium-browser @@ -3,7 +3,6 @@ # Chroot wrapper # -# Syntax if [ -z "$1" ]; then chroot="squeeze" else diff --git a/chroot-upgrade b/chroot-upgrade index 562df39..44a2c57 100755 --- a/chroot-upgrade +++ b/chroot-upgrade @@ -1,6 +1,6 @@ #!/bin/bash # -# Chroot mass upgrader. +# Chroot mass upgrader # BASE="/var/chroot/" @@ -1,6 +1,6 @@ #!/bin/bash # -# Commit both on git and svn. +# Commit both on git and svn # # Check if a folder is inside a git repository diff --git a/gpg-agent-eval b/gpg-agent-eval index 6fa169a..28bbfba 100755 --- a/gpg-agent-eval +++ b/gpg-agent-eval @@ -1,6 +1,6 @@ #!/bin/bash # -# Initialize the gpg-agent. +# Initialize the gpg-agent # # GPG Agent diff --git a/misc/annex-fsck b/misc/annex-fsck deleted file mode 100755 index 2ef8066..0000000 --- a/misc/annex-fsck +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -cd /var/cache/media - -for file in *; do - if [ -d "$file/.git" ]; then - ( echo "Checking $file..." && cd $file && git annex fsck --fast | grep -v " ok" | tee -a /tmp/annex-fsck.log ) - fi -done diff --git a/misc/convert-gitosis-conf b/misc/convert-gitosis-conf deleted file mode 100755 index 9b92f68..0000000 --- a/misc/convert-gitosis-conf +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/perl -w -# -# migrate gitosis.conf to gitolite.conf format -# -# Based on gl-conf-convert by: Sitaram Chamarty -# Rewritten by: Behan Webster <behanw@websterwood.com> -# - -use strict; -use warnings; - -if (not @ARGV and -t or @ARGV and $ARGV[0] eq '-h') { - print "Usage:\n gl-conf-convert < gitosis.conf > gitolite.conf\n(please see the documentation for details)\n"; - exit 1; -} - -my @comments = (); -my $groupname; -my %groups; -my $reponame; -my %repos; - -while (<>) -{ - # not supported - if (/^repositories *=/ or /^map /) { - print STDERR "not supported: $_"; - s/^/NOT SUPPORTED: /; - print; - next; - } - - # normalise whitespace to help later regexes - chomp; - s/\s+/ /g; - s/ ?= ?/ = /; - s/^ //; - s/ $//; - - if (/^\s*$/ and @comments > 1) { - @{$repos{$reponame}{comments}} = @comments if $reponame; - @{$groups{$groupname}{comments}} = @comments if $groupname; - @comments = (); - } elsif (/^\s*#/) { - push @comments, $_; - } elsif (/^\[repo\s+(.*?)\]$/) { - $groupname = ''; - $reponame = $1; - $reponame =~ s/\.git$//; - } elsif (/^\[gitosis\]$/) { - $groupname = ''; - $reponame = '@all'; - } elsif (/^gitweb\s*=\s*yes/i) { - push @{$repos{$reponame}{R}}, 'gitweb'; - } elsif (/^daemon\s*=\s*yes/i) { - push @{$repos{$reponame}{R}}, 'daemon'; - } elsif (/^description\s*=\s*(.+?)$/) { - $repos{$reponame}{desc} = $1; - } elsif (/^owner\s*=\s*(.+?)$/) { - $repos{$reponame}{owner} = $1; - } elsif (/^\[group\s+(.*)\]$/) { - $reponame = ''; - $groupname = $1; - } elsif (/^members\s*=\s*(.*)/) { - push @{$groups{$groupname}{users}}, map {s/\@([^.]+)$/_$1/g; $_} split(' ', $1); - } elsif (/^write?able\s*=\s*(.*)/) { - foreach my $repo (split(' ', $1)) { - $repo =~ s/\.git$//; - push @{$repos{$repo}{RW}}, "\@$groupname"; - } - } elsif (/^readonly\s*=\s*(.*)/) { - foreach my $repo (split(' ', $1)) { - $repo =~ s/\.git$//; - push @{$repos{$repo}{R}}, "\@$groupname"; - } - } -} - -#use Data::Dumper; -#print Dumper(\%repos); -#print Dumper(\%groups); - -# Groups -print "#\n# Groups\n#\n\n"; -foreach my $grp (sort keys %groups) { - next unless @{$groups{$grp}{users}}; - printf join("\n", @{$groups{$grp}{comments}})."\n" if $groups{$grp}{comments}; - printf "\@%-19s = %s\n", $grp, join(' ', @{$groups{$grp}{users}}); -} - -# Gitweb -print "\n#\n# Gitweb\n#\n\n"; -foreach my $repo (sort keys %repos) { - if ($repos{$repo}{desc}) { - @{$repos{$repo}{R}} = grep(!/^gitweb$/, @{$repos{$repo}{R}}); - print $repo; - print " \"$repos{$repo}{owner}\"" if $repos{$repo}{owner}; - print " = \"$repos{$repo}{desc}\"\n"; - } -} - -# Repos -print "\n#\n# Repos\n#\n"; -foreach my $repo (sort keys %repos) { - print "\n"; - printf join("\n", @{$repos{$repo}{comments}})."\n" if $repos{$repo}{comments}; - #if ($repos{$repo}{desc}) { - # @{$repos{$repo}{R}} = grep(!/^gitweb$/, @{$repos{$repo}{R}}); - #} - print "repo\t$repo\n"; - foreach my $access (qw(RW+ RW R)) { - next unless $repos{$repo}{$access}; - my @keys; - foreach my $key (@{$repos{$repo}{$access}}) { - if ($key =~ /^\@(.*)/) { - next unless defined $groups{$1} and @{$groups{$1}{users}}; - } - push @keys, $key; - } - printf "\t$access\t= %s\n", join(' ', @keys) if @keys; - } - #if ($repos{$repo}{desc}) { - # print $repo; - # print " \"$repos{$repo}{owner}\"" if $repos{$repo}{owner}; - # print " = \"$repos{$repo}{desc}\"\n"; - #} -} diff --git a/misc/email/checkmail.sh b/misc/email/checkmail index 3a21c9a..078f111 100755 --- a/misc/email/checkmail.sh +++ b/misc/email/checkmail @@ -1,9 +1,14 @@ #!/bin/bash -# inspirado em http://www.vivaolinux.com.br/dicas/verDica.php?codigo=2432 +# +# Simple mail counter +# Inspired by http://www.vivaolinux.com.br/dicas/verDica.php?codigo=2432 # +# Fetch and compute FETCH=`fetchmail -c` TOTAL=`echo $FETCH | awk '{ print $1 }'` SEEN=`echo $FETCH | awk '{ print $3 }' | sed -e 's/(//'` NEW=`echo "$TOTAL - $SEEN" | bc` + +# Display response echo $NEW/$TOTAL diff --git a/misc/email/vcard-filter b/misc/email/vcard-filter index 363aa07..363aa07 100644..100755 --- a/misc/email/vcard-filter +++ b/misc/email/vcard-filter diff --git a/misc/eterm-trans b/misc/eterm-trans index 5003ddb..1a6d52d 100755 --- a/misc/eterm-trans +++ b/misc/eterm-trans @@ -1,6 +1,6 @@ #!/bin/bash # -# eterm-trans: wrapper script for a transparent Eterm +# Wrapper script for a transparent terminal # Eterm --trans --font1 monospace --scrollbar 0 -f white --buttonbar 0 --borderless -g 124x55+10+20 -c white -neterm diff --git a/misc/firefox-rotate b/misc/firefox-rotate deleted file mode 100755 index e116e0a..0000000 --- a/misc/firefox-rotate +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# firefox profile local backup -# - -BACKUPDIR="$HOME/backups/mozilla" - -if [ ! -d "/$BACKUPDIR" ]; then - mkdir -p $BACKUPDIR -fi - -if [ -d "/$BACKUPDIR/mozilla.2" ]; then - rm -rf /$BACKUPDIR/mozilla.2 -fi - -if [ -d "/$BACKUPDIR/mozilla.1" ]; then - mv /$BACKUPDIR/mozilla.1 /$BACKUPDIR/mozilla.2 -fi - -cp -Rp $HOME/.mozilla /$BACKUPDIR/mozilla.1 - diff --git a/misc/freeshell b/misc/freeshell index a2f6e38..ad98ff2 100755 --- a/misc/freeshell +++ b/misc/freeshell @@ -1,4 +1,9 @@ #!/usr/bin/expect +# +# Simple telnet application to log in a server +# WARNING: passphrase is sent in the clear! +# + spawn telnet freeshell.org # Not absolutely necessary, but good to keep the spawn_id for later set telnet $spawn_id diff --git a/misc/google b/misc/google deleted file mode 100755 index b0e15ea..0000000 --- a/misc/google +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -BROWSER=lynx - -if [ $# -eq 0 ] -then - echo "Usage: chkargs argument..." 1>&2 - exit 1 -fi - -search=$1 -while shift -do - search="$search+$1" -done - -$BROWSER "http://www.google.com/search?q=$search" & diff --git a/misc/mount-tablet b/misc/mount-tablet deleted file mode 100755 index b73c2eb..0000000 --- a/misc/mount-tablet +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -# -# mount-tablet -# - -# Parameters -BASENAME="`basename $0`" -MOUNTPOINT="/media/tablet" - -# Set sudo config -if [ "`whoami`" != 'root' ]; then - sudo="sudo" -fi - -if [ "$BASENAME" == "mount-tablet" ]; then - $sudo mkdir -p $MOUNTPOINT - $sudo mtpfs -o allow_other $MOUNTPOINT -elif [ "$BASENAME" == "umount-tablet" ]; then - $sudo umount $MOUNTPOINT -fi - diff --git a/misc/noisecd b/misc/noisecd deleted file mode 100755 index c83bbc1..0000000 --- a/misc/noisecd +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -# noisecd: add noise cd to rhatto's -# noise cd txt database -# -# feedback: rhatto@riseup.net | GPL -# -# cansado(a) de nao saber onde estah aquela musica ou arquivo num -# sistema de armazenamento distribuido em dezenas de cds? -# -# aqui estah sua solucao! mantenha uma arvore completa de todos os -# seus arquivos disponiveis em midia removivel no seu proprio -# diretorio pessoal, com um truque muito simples. -# -# etiquete os seus cds de mp3, por exemplo, de noise 1, noise 2, -# noise 3, ..., noise n; em seguida, crie n pastas com os nomes iguais -# ao nome de cada cd; em seguida, monte o cd e entre em sua pasta -# especifica e de um comando do tipo -# -# cp -R -s /cdrom/* . -# -# isso criara recursivamente em sua pasta os links simbolicos que vao -# direto pros arquivos do cd, desde que este seja o cd atualmente montado. -# -# se voce fizer com todos os seus cds de musica, o resultado sera uma -# arvore completa contendo links simbolicos para arquivos dos cds. -# -# com isso voce pode procurar suas musicas mais facilmente atraves do find -# ou do locate, ou entao navegando entre as pastas; uma vez achado o -# arquivo desejado, eh soh montar o respectivo cd e ir pra galera! -# -# este script eh um exemplo de como automatizar a tarefa de criar essa arvore. -# - -NOISE_TREE=/var/data/catalogo/noise -NOISE_DATABASE=$NOISE_TREE/noise-cd.txt -NOISE_DIR=/media/cdrom -NOISE_MODE="complex" - -if [ -z "$1" ]; then - echo "usage: `basename $0` <cd-number>" - exit 1 -fi - -cd $NOISE_DIR -ls -R -A -1 | sed -e "s/^/$1 /" >> $NOISE_DATABASE - -if [ "$NOISE_MODE" != "simple" ]; then - - mkdir "$NOISE_TREE/noise-$1" - cd "$NOISE_TREE/noise-$1" - cp -R -s $NOISE_DIR/* . - - cd "$NOISE_TREE" - rm -f noise-tree.tar.gz; cd .. - tar zcvf noise-tree.tar.gz "$NOISE_TREE/" - mv noise-tree.tar.gz "$NOISE_TREE/" - -fi diff --git a/misc/parse_remind.pl b/misc/parse-remind index bdd9f23..bdd9f23 100644..100755 --- a/misc/parse_remind.pl +++ b/misc/parse-remind diff --git a/misc/ps_mem.py b/misc/ps_mem.py deleted file mode 100755 index deae67f..0000000 --- a/misc/ps_mem.py +++ /dev/null @@ -1,240 +0,0 @@ -#!/usr/bin/env python - -# Try to determine how much RAM is currently being used per program. -# Note per _program_, not per process. So for example this script -# will report RAM used by all httpd process together. In detail it reports: -# sum(private RAM for program processes) + sum(Shared RAM for program processes) -# The shared RAM is problematic to calculate, and this script automatically -# selects the most accurate method available for your kernel. - -# Author: P@draigBrady.com -# Source: http://www.pixelbeat.org/scripts/ps_mem.py - -# V1.0 06 Jul 2005 Initial release -# V1.1 11 Aug 2006 root permission required for accuracy -# V1.2 08 Nov 2006 Add total to output -# Use KiB,MiB,... for units rather than K,M,... -# V1.3 22 Nov 2006 Ignore shared col from /proc/$pid/statm for -# 2.6 kernels up to and including 2.6.9. -# There it represented the total file backed extent -# V1.4 23 Nov 2006 Remove total from output as it's meaningless -# (the shared values overlap with other programs). -# Display the shared column. This extra info is -# useful, especially as it overlaps between programs. -# V1.5 26 Mar 2007 Remove redundant recursion from human() -# V1.6 05 Jun 2007 Also report number of processes with a given name. -# Patch from riccardo.murri@gmail.com -# V1.7 20 Sep 2007 Use PSS from /proc/$pid/smaps if available, which -# fixes some over-estimation and allows totalling. -# Enumerate the PIDs directly rather than using ps, -# which fixes the possible race between reading -# RSS with ps, and shared memory with this program. -# Also we can show non truncated command names. -# V1.8 28 Sep 2007 More accurate matching for stats in /proc/$pid/smaps -# as otherwise could match libraries causing a crash. -# Patch from patrice.bouchand.fedora@gmail.com -# V1.9 20 Feb 2008 Fix invalid values reported when PSS is available. -# Reported by Andrey Borzenkov <arvidjaar@mail.ru> - -# Notes: -# -# All interpreted programs where the interpreter is started -# by the shell or with env, will be merged to the interpreter -# (as that's what's given to exec). For e.g. all python programs -# starting with "#!/usr/bin/env python" will be grouped under python. -# You can change this by changing comm= to args= below but that will -# have the undesirable affect of splitting up programs started with -# differing parameters (for e.g. mingetty tty[1-6]). -# -# For 2.6 kernels up to and including 2.6.13 and later 2.4 redhat kernels -# (rmap vm without smaps) it can not be accurately determined how many pages -# are shared between processes in general or within a program in our case: -# http://lkml.org/lkml/2005/7/6/250 -# A warning is printed if overestimation is possible. -# In addition for 2.6 kernels up to 2.6.9 inclusive, the shared -# value in /proc/$pid/statm is the total file-backed extent of a process. -# We ignore that, introducing more overestimation, again printing a warning. -# Since kernel 2.6.23-rc8-mm1 PSS is available in smaps, which allows -# us to calculate a more accurate value for the total RAM used by programs. -# -# I don't take account of memory allocated for a program -# by other programs. For e.g. memory used in the X server for -# a program could be determined, but is not. - -import sys, os, string - -if os.geteuid() != 0: - sys.stderr.write("Sorry, root permission required.\n"); - sys.exit(1) - -PAGESIZE=os.sysconf("SC_PAGE_SIZE")/1024 #KiB -our_pid=os.getpid() - -#(major,minor,release) -def kernel_ver(): - kv=open("/proc/sys/kernel/osrelease").readline().split(".")[:3] - for char in "-_": - kv[2]=kv[2].split(char)[0] - return (int(kv[0]), int(kv[1]), int(kv[2])) - -kv=kernel_ver() - -have_pss=0 - -#return Private,Shared -#Note shared is always a subset of rss (trs is not always) -def getMemStats(pid): - global have_pss - Private_lines=[] - Shared_lines=[] - Pss_lines=[] - Rss=int(open("/proc/"+str(pid)+"/statm").readline().split()[1])*PAGESIZE - if os.path.exists("/proc/"+str(pid)+"/smaps"): #stat - for line in open("/proc/"+str(pid)+"/smaps").readlines(): #open - if line.startswith("Shared"): - Shared_lines.append(line) - elif line.startswith("Private"): - Private_lines.append(line) - elif line.startswith("Pss"): - have_pss=1 - Pss_lines.append(line) - Shared=sum([int(line.split()[1]) for line in Shared_lines]) - Private=sum([int(line.split()[1]) for line in Private_lines]) - #Note Shared + Private = Rss above - #The Rss in smaps includes video card mem etc. - if have_pss: - pss_adjust=0.5 #add 0.5KiB as this average error due to trunctation - Pss=sum([float(line.split()[1])+pss_adjust for line in Pss_lines]) - Shared = Pss - Private - elif (2,6,1) <= kv <= (2,6,9): - Shared=0 #lots of overestimation, but what can we do? - Private = Rss - else: - Shared=int(open("/proc/"+str(pid)+"/statm").readline().split()[2]) - Shared*=PAGESIZE - Private = Rss - Shared - return (Private, Shared) - -def getCmdName(pid): - cmd = file("/proc/%d/status" % pid).readline()[6:-1] - exe = os.path.basename(os.path.realpath("/proc/%d/exe" % pid)) - if exe.startswith(cmd): - cmd=exe #show non truncated version - #Note because we show the non truncated name - #one can have separated programs as follows: - #584.0 KiB + 1.0 MiB = 1.6 MiB mozilla-thunder (exe -> bash) - # 56.0 MiB + 22.2 MiB = 78.2 MiB mozilla-thunderbird-bin - return cmd - -cmds={} -shareds={} -count={} -for pid in os.listdir("/proc/"): - try: - pid = int(pid) #note Thread IDs not listed in /proc/ which is good - if pid == our_pid: continue - except: - continue - try: - cmd = getCmdName(pid) - except: - #permission denied or - #kernel threads don't have exe links or - #process gone - continue - try: - private, shared = getMemStats(pid) - except: - continue #process gone - if shareds.get(cmd): - if have_pss: #add shared portion of PSS together - shareds[cmd]+=shared - elif shareds[cmd] < shared: #just take largest shared val - shareds[cmd]=shared - else: - shareds[cmd]=shared - cmds[cmd]=cmds.setdefault(cmd,0)+private - if count.has_key(cmd): - count[cmd] += 1 - else: - count[cmd] = 1 - -#Add shared mem for each program -total=0 -for cmd in cmds.keys(): - cmds[cmd]=cmds[cmd]+shareds[cmd] - total+=cmds[cmd] #valid if PSS available - -sort_list = cmds.items() -sort_list.sort(lambda x,y:cmp(x[1],y[1])) -sort_list=filter(lambda x:x[1],sort_list) #get rid of zero sized processes - -#The following matches "du -h" output -#see also human.py -def human(num, power="Ki"): - powers=["Ki","Mi","Gi","Ti"] - while num >= 1000: #4 digits - num /= 1024.0 - power=powers[powers.index(power)+1] - return "%.1f %s" % (num,power) - -def cmd_with_count(cmd, count): - if count>1: - return "%s (%u)" % (cmd, count) - else: - return cmd - -print " Private + Shared = RAM used\tProgram \n" -for cmd in sort_list: - print "%8sB + %8sB = %8sB\t%s" % (human(cmd[1]-shareds[cmd[0]]), - human(shareds[cmd[0]]), human(cmd[1]), - cmd_with_count(cmd[0], count[cmd[0]])) -if have_pss: - print "-" * 33 - print " " * 24 + "%8sB" % human(total) - print "=" * 33 -print "\n Private + Shared = RAM used\tProgram \n" - -#Warn of possible inaccuracies -#2 = accurate & can total -#1 = accurate only considering each process in isolation -#0 = some shared mem not reported -#-1= all shared mem not reported -def shared_val_accuracy(): - """http://wiki.apache.org/spamassassin/TopSharedMemoryBug""" - if kv[:2] == (2,4): - if open("/proc/meminfo").read().find("Inact_") == -1: - return 1 - return 0 - elif kv[:2] == (2,6): - if os.path.exists("/proc/"+str(os.getpid())+"/smaps"): - if open("/proc/"+str(os.getpid())+"/smaps").read().find("Pss:")!=-1: - return 2 - else: - return 1 - if (2,6,1) <= kv <= (2,6,9): - return -1 - return 0 - else: - return 1 - -vm_accuracy = shared_val_accuracy() -if vm_accuracy == -1: - sys.stderr.write( - "Warning: Shared memory is not reported by this system.\n" - ) - sys.stderr.write( - "Values reported will be too large, and totals are not reported\n" - ) -elif vm_accuracy == 0: - sys.stderr.write( - "Warning: Shared memory is not reported accurately by this system.\n" - ) - sys.stderr.write( - "Values reported could be too large, and totals are not reported\n" - ) -elif vm_accuracy == 1: - sys.stderr.write( - "Warning: Shared memory is slightly over-estimated by this system\n" - "for each program, so totals are not reported.\n" - ) diff --git a/misc/scan b/misc/scan deleted file mode 100755 index 0b4c9eb..0000000 --- a/misc/scan +++ /dev/null @@ -1 +0,0 @@ -sudo pxscan --port=0x378 --pos=0.0x0.0 --dim=8.49554140127x11.7 --color=-30/0/1.0 --res=100 -n $HOME/scanned-image.tif @@ -1,6 +1,6 @@ #!/bin/bash # -# shell: wrapper for a simple terminal console +# Wrapper script for a simple terminal # Eterm -g 110x45+320+90 +sb -f white -F smooth --borderless no --buttonbar 0 --scrollbar 0 -P None -nterminal diff --git a/misc/snownews b/misc/snownews deleted file mode 100755 index 3cf3a9f..0000000 --- a/misc/snownews +++ /dev/null @@ -1 +0,0 @@ -Eterm --background-pixmap 0 --scrollbar 0 --buttonbar 0 -g 125x43+6-45 -F vga -n snownews -e snownews diff --git a/misc/splash.sh b/misc/splash.sh deleted file mode 100755 index 415f36e..0000000 --- a/misc/splash.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -if [ -z $2 ]; then echo "usage: $0 <kernel-version> <splash-theme>"; exit 1; fi - -cd /boot -mkinitrd -c $1 -splash -s -f /etc/bootsplash/themes/$2/config/bootsplash-1024x768.cfg >> /boot/initrd.gz diff --git a/misc/term-color b/misc/term-color deleted file mode 100755 index 85bf44b..0000000 --- a/misc/term-color +++ /dev/null @@ -1,43 +0,0 @@ -#! /usr/bin/env python -# Copyright (C) 2006 by Johannes Zellner, <johannes@zellner.org> -# modified by mac@calmar.ws to fit my output needs -# modified by crncosta@carloscosta.org to fit my output needs -# pyroscope.project@gmail.com added a final "tput init", and changed the output format - -import os -import sys - -def echo(msg): - os.system('echo -n "' + str(msg) + '"') - -def out(n): - os.system("tput setab " + str(n) + "; echo -n " + ("\"% 4d\"" % n)) - os.system("tput setab 0") - -if os.getenv("TERM") in ("xterm", "screen"): - os.putenv("TERM", os.getenv("TERM") + "-256color") - -try: - # normal colors 1 - 16 - os.system("tput setaf 16") - for n in range(8): - out(n) - echo("\n") - for n in range(8, 16): - out(n) - - echo("\n") - echo("\n") - - y=16 - while y < 256: - for z in range(0,18): - out(y) - y += 1 - if y >= 256: break - - echo("\n") - - echo("\n") -finally: - os.system("tput init") diff --git a/misc/umount-tablet b/misc/umount-tablet deleted file mode 120000 index ee40196..0000000 --- a/misc/umount-tablet +++ /dev/null @@ -1 +0,0 @@ -mount-tablet
\ No newline at end of file @@ -1,6 +1,6 @@ #!/bin/bash # -# Wifi initializer. +# Wifi initializer # #DEVICE="ath0" diff --git a/misc/xbitchx b/misc/xbitchx deleted file mode 100755 index e5b524e..0000000 --- a/misc/xbitchx +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# xbitchx: execute bitchx under a X Terminal -# - -# Using rxvt -# rxvt -bg black +sb -fg white -fn vga -g 120x40+30+55 -name BitchX -e BitchX -p 994 -ssl irc.indymedia.org - -# Old version using Eterm -# Eterm --background-pixmap 0 --scrollbar 0 +sb -b black -f white -F vga --borderless no --buttonbar 0 \ -# -g 120x40+30+55 -nBitchX -e BitchX -p 994 -ssl irc.indymedia.org - -# Old version using feast and Eterm -# xfeast -# Eterm --background-pixmap 0 --scrollbar 0 +sb -b black -f white -F vga --borderless no --buttonbar 0 \ -# -g 120x40+30+55 -nBitchX -e BitchX -p 994 -ssl irc.indymedia.org - -# Current version -Eterm --background-pixmap 0 --scrollbar 0 +sb -b black -f white -F vga --borderless no --buttonbar 0 \ - -g 120x40+30+55 -nBitchX -e BitchX -p 6667 127.0.0.1 diff --git a/misc/xcamp b/misc/xcamp deleted file mode 100755 index 6ae9fd2..0000000 --- a/misc/xcamp +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -# xcamp: wrapper for camp console music player -# - -# Set possible geometries -BOTTOM_LEFT="75x20+10+410" -BOTTOM_RIGHT="75x20+415+410" -TOP_LEFT="75x20+10+5" -TOP_RIGHT="75x20+415+5" -TOP_RIGHT_2="500+420" -TOP_RIGHT_3="500+385" - -# Set default geometry -GEOMETRY="$TOP_RIGHT_3" - -Eterm --trans -F VGA --scrollbar 0 --buttonbar 0 --borderless -g $GEOMETRY -e camp diff --git a/misc/xfeast b/misc/xfeast deleted file mode 100755 index 8a8504a..0000000 --- a/misc/xfeast +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# -# xfeast: execute silc gateway -# - -pid="$HOME/tmp/silc.pid" -if [[ -f "$pid" ]]; then - if `ps $pid | grep -q $pid`; then - kill `cat $pid` - fi - rm $pid -fi -netcat -l -p 1706 -e "/usr/bin/feast .feast.conf" & -echo "$!" > $pid -trap "kill `cat $pid`" 2 15 diff --git a/misc/xgkrellm b/misc/xgkrellm deleted file mode 100755 index 857b85e..0000000 --- a/misc/xgkrellm +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# -# xgrellm: wrapper for gkrellm -# - -#gkreallm -w -gkrellm -g +945+545 diff --git a/misc/xterm b/misc/xterm deleted file mode 100755 index baebbce..0000000 --- a/misc/xterm +++ /dev/null @@ -1 +0,0 @@ -xterm -bg black -fg white -font -misc-fixed-bold-*-*-*-*-*-*-*-*-*-*-* @@ -1,5 +1,7 @@ #! /usr/bin/python # +# Email filter +# # This is a slighted channged version of Philter available at # http://philter.sourceforge.net written by Prabhakar V. Chaganti and # distributed under GPLv2. @@ -1,7 +1,7 @@ #!/bin/bash # -# rhatto's maildir simple filter -# feedback: rhatto at riseup.net | gpl +# Maildir simple filter +# Feedback: rhatto at riseup.net | gpl # PREFILTER="$HOME/apps/scripts/philter.py" diff --git a/refresh-keys b/refresh-keys index 90ddda4..31c579a 100755 --- a/refresh-keys +++ b/refresh-keys @@ -1,4 +1,6 @@ #!/bin/sh +# +# Wrapper for gpg --refresh-keys # See http://pastebin.com/raw.php?i=XL0WAVSA for key in `gpg --list-keys --with-colons | grep "^pub" | cut -f5 -d":" | sort --random-sort` diff --git a/ssh-agent-eval b/ssh-agent-eval index 3123967..2edf711 100755 --- a/ssh-agent-eval +++ b/ssh-agent-eval @@ -1,6 +1,6 @@ #!/bin/bash # -# Initializes the ssh-agent. +# Initializes the ssh-agent # # SSH Agent @@ -1,5 +1,7 @@ #!/bin/bash # +# SSL wrapper scripts +# # This code is licensed under a Creative Commons License. # http://creativecommons.org/licenses/by-nc-sa/3.0/ # @@ -8,7 +10,7 @@ # show usage # function usage { - echo "SSL Wrapper scripts" + echo "SSL wrapper scripts" echo "Based on http://www.madboa.com/geek/openssl/" } diff --git a/ssl-cert-check b/ssl-cert-check deleted file mode 100755 index 72de361..0000000 --- a/ssl-cert-check +++ /dev/null @@ -1,705 +0,0 @@ -#!/bin/bash -# -# Program: SSL Certificate Check <ssl-cert-check> -# -# Source code home: http://prefetch.net/code/ssl-cert-check -# -# Documentation: http://prefetch.net/articles/checkcertificate.html -# -# Author: Matty < matty91 at gmail dot com > -# -# Current Version: 3.21 -# -# Revision History: - -# Version 3.21 -# - Adjust e-mail checking to avoid exiting if notifications aren't enabled -- Nick Anderson -# - Added the number of days until expiration to the Nagios output -- Nick Anderson -# -# Version 3.20 -# - Fixed a bug in certificate length checking -- Tim Nowaczyk -# -# Version 3.19 -# - Added check to verify the certificate retrieved is valid -# -# Version 3.18 -# - Add support for connecting to FTP servers -- Paul A Sand -# -# Version 3.17 -# - Add support for connecting to imap servers -- Joerg Pareigis -# -# Version 3.16 -# - Add support for connecting to the mail sbmission port -- Luis E. Munoz -# -# Version 3.15 -# - Adjusted the file checking logic to use the correct certificate -- Maciej Szudejko -# - Add sbin to the default search paths for OpenBSD compatibility -- Alex Popov -# - Use cut instead of substring processing to ensure compatibility -- Alex Popov -# -# Version 3.14 -# - Fixed the Common Name parser to handle DN's where the CN is not the last item -# eg. EmailAddr -- Jason Brothers -# - Added the ability to grab the serial number -- Jason Brothers -# - Added the "-b" option to print results without a header -- Jason Brothers -# - Added the "-v" option for certificate validation -- Jason Brothers -# -# Version 3.13 -# - Updated the subject line to include the hostname as well as -# the common name embedded in the X509 certificate (if it's -# available) -- idea proposed by Mike Burns -# -# Version 3.12 -# - Updated the license to allow redistribution and modification -# -# Version 3.11 -# - Added ability to comment out lines in files passed -# to the "-f" option -- Brett Stauner -# - Fixed comment next to file processing logic -# -# Version 3.10 -# - Fixed POP3 port -- Simon Matter -# -# Version 3.9 -# - Switched binary location logic to use which utility -# -# Version 3.8 -# - Fixed display on 80 column displays -# - Cleaned up the formatting -# -# Version 3.7 -# - Fixed bug in NAGIOS tests -- Ben Allen -# -# Version 3.6 -# - Added support for certificates stored in PKCS#12 databases -- Ken Gallo -# - Cleaned up comments -# - Adjusted variables to be more consistent -# -# Version 3.5 -# - Added support for NAGIOS -- Quanah Gibson-Mount -# - Added additional checks for mail -- Quanah Gibson-Mount -# - Convert tabs to spaces -- Quanah Gibson-Mount -# - Cleaned up usage() routine -# - Added additional checks for openssl -# -# Version 3.4 -# - Added a missing "{" to line 364 -- Ken Gallo -# - Move mktemp to the start of the main body to avoid errors -# - Adjusted default binary paths to make sure the script just works -# w/ Solaris, BSD and Linux hosts -# -# Version 3.3 -# - Added common name from X.509 certificate file to E-mail body / header -- Doug Curtis -# - Fixed several documentation errors -# - Use mktemp to create temporary files -# - Convert printf, sed and awk to variables -# - Check for printf, sed, awk and mktemp binaries -# - Add additional logic to make sure mktemp returned a valid temporary file -# -# Version 3.2 -# - Added option to list certificates in the file passed to "-f". -# -# Version 3.1 -# - Added handling for starttls for smtp -- Marco Amrein -# - Added handling for starttls for pop3 (without s) -- Marco Amrein -# - Removed extra spacing at end of script -# -# Version 3.0 -# - Added "-i" option to print certificate issuer -# - Removed $0 from Subject line of outbound e-mails -# - Fixed some typographical errors -# - Removed redundant "-b" option -# -# Version 2.0 -# - Fixed an issue with e-mails formatting incorrectly -# - Added additional space to host column -- Darren-Perot Spruell -# - Replaced GNU date dependency with CHRIS F. A. JOHNSON's -# date2julian shell function. This routine can be found on -# page 170 of Chris's book "Shell Scripting Recipes: A -# Problem-Solution Approach," ISBN #1590594711. Julian function -# was created based on a post to comp.unix.shell by Tapani Tarvainen. -# - Cleaned up function descriptions -# - Removed several lines of redundant code -# - Adjusted the help message -# -# Version 1.1 -# - Added "-c" flag to report expiration status of a PEM encoded -# certificate -- Hampus Lundqvist -# - Updated the prints messages to display the reason a connection -# failed (connection refused, connection timeout, bad cert, etc) -# - Updated the GNU date checking routines -# - Added checks for each binary required -# - Added checks for connection timeouts -# - Added checks for GNU date -# - Added a "-h" option -# - Cleaned up the documentation -# -# Version 1.0 -# Initial Release -# -# Last Updated: 11-23-2010 -# -# Purpose: -# ssl-cert-check checks to see if a digital certificate in X.509 format -# has expired. ssl-cert-check can be run in interactive and batch mode, -# and provides facilities to alarm if a certificate is about to expire. -# -# License: -# 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. -# -# Requirements: -# Requires openssl -# -# Installation: -# Copy the shell script to a suitable location -# -# Tested platforms: -# -- Solaris 9 using /bin/bash -# -- Solaris 10 using /bin/bash -# -- OS X 10.4.2 using /bin/sh -# -- OpenBSD using /bin/sh -# -- FreeBSD using /bin/sh -# -- Redhat Enterprise Linux 3, 4, 5 & 6 -# -# Usage: -# Refer to the usage() sub-routine, or invoke ssl-cert-check -# with the "-h" option. -# -# Examples: -# Please refer to the following site for documentation and -# examples: -# http://prefetch.net/articles/checkcertificate.html -# - -PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/ssl/bin:/usr/sfw/bin -export PATH - -# Who to page when an expired certificate is detected (cmdline: -e) -ADMIN="root" - -# Number of days in the warning threshhold (cmdline: -x) -WARNDAYS=30 - -# If QUIET is set to TRUE, don't print anything on the console (cmdline: -q) -QUIET="FALSE" - -# Don't send E-mail by default (cmdline: -a) -ALARM="FALSE" - -# Don't run as a Nagios plugin by default (cmdline: -n) -NAGIOS="FALSE" - -# NULL out the PKCSDBPASSWD variable for later use (cmdline: -k) -PKCSDBPASSWD="" - -# Location of system binaries -AWK=$(which awk) -DATE=$(which date) -GREP=$(which grep) -OPENSSL=$(which openssl) -PRINTF=$(which printf) -SED=$(which sed) -MKTEMP=$(which mktemp) - -# Return code used by nagios. Initialize to 0. -RETCODE=0 - -# Set the default umask to be somewhat restrictive -umask 077 - -############################################################################# -# Purpose: Convert a date from MONTH-DAY-YEAR to Julian format -# Acknowledgements: Code was adapted from examples in the book -# "Shell Scripting Recipes: A Problem-Solution Approach" -# ( ISBN 1590594711 ) -# Arguments: -# $1 -> Month (e.g., 06) -# $2 -> Day (e.g., 08) -# $3 -> Year (e.g., 2006) -############################################################################# -date2julian() { - - if [ "${1} != "" ] && [ "${2} != "" ] && [ "${3}" != "" ] - then - ## Since leap years add aday at the end of February, - ## calculations are done from 1 March 0000 (a fictional year) - d2j_tmpmonth=$((12 * ${3} + ${1} - 3)) - - ## If it is not yet March, the year is changed to the previous year - d2j_tmpyear=$(( ${d2j_tmpmonth} / 12)) - - ## The number of days from 1 March 0000 is calculated - ## and the number of days from 1 Jan. 4713BC is added - echo $(( (734 * ${d2j_tmpmonth} + 15) / 24 - - 2 * ${d2j_tmpyear} + ${d2j_tmpyear}/4 - - ${d2j_tmpyear}/100 + ${d2j_tmpyear}/400 + $2 + 1721119 )) - else - echo 0 - fi -} - -############################################################################# -# Purpose: Convert a string month into an integer representation -# Arguments: -# $1 -> Month name (e.g., Sep) -############################################################################# -getmonth() -{ - case ${1} in - Jan) echo 1 ;; - Feb) echo 2 ;; - Mar) echo 3 ;; - Apr) echo 4 ;; - May) echo 5 ;; - Jun) echo 6 ;; - Jul) echo 7 ;; - Aug) echo 8 ;; - Sep) echo 9 ;; - Oct) echo 10 ;; - Nov) echo 11 ;; - Dec) echo 12 ;; - *) echo 0 ;; - esac -} - -############################################################################# -# Purpose: Calculate the number of seconds between two dates -# Arguments: -# $1 -> Date #1 -# $2 -> Date #2 -############################################################################# -date_diff() -{ - if [ "${1}" != "" ] && [ "${2}" != "" ] - then - echo $((${2} - ${1})) - else - echo 0 - fi -} - -##################################################################### -# Purpose: Print a line with the expiraton interval -# Arguments: -# $1 -> Hostname -# $2 -> TCP Port -# $3 -> Status of certification (e.g., expired or valid) -# $4 -> Date when certificate will expire -# $5 -> Days left until the certificate will expire -# $6 -> Issuer of the certificate -##################################################################### -prints() -{ - if [ "${QUIET}" != "TRUE" ] && [ "${ISSUER}" = "TRUE" ] && [ "${VALIDATION}" != "TRUE" ] - then - MIN_DATE=$(echo $4 | ${AWK} '{ print $1, $2, $4 }') - if [ "${NAGIOS}" == "TRUE" ] - then - ${PRINTF} "%-35s %-17s %-8s %-11s %-4s %-30s\n" "$1:$2" "$6" "$3" "$MIN_DATE" \|days="$5" - else - ${PRINTF} "%-35s %-17s %-8s %-11s %-4s %-30s\n" "$1:$2" "$6" "$3" "$MIN_DATE" "$5" - fi - elif [ "${QUIET}" != "TRUE" ] && [ "${ISSUER}" = "TRUE" ] && [ "${VALIDATION}" == "TRUE" ] - then - ${PRINTF} "%-35s %-35s %-32s %-17s\n" "$1:$2" "$7" "$8" "$6" - - elif [ "${QUIET}" != "TRUE" ] && [ "${VALIDATION}" != "TRUE" ] - then - MIN_DATE=$(echo $4 | ${AWK} '{ print $1, $2, $4 }') - if [ "${NAGIOS}" == "TRUE" ] - then - ${PRINTF} "%-47s %-12s %-12s %-4s %-30s\n" "$1:$2" "$3" "$MIN_DATE" \|days="$5" - else - ${PRINTF} "%-47s %-12s %-12s %-4s %-30s\n" "$1:$2" "$3" "$MIN_DATE" "$5" - fi - elif [ "${QUIET}" != "TRUE" ] && [ "${VALIDATION}" == "TRUE" ] - then - ${PRINTF} "%-35s %-35s %-32s\n" "$1:$2" "$7" "$8" - fi -} - - -#################################################### -# Purpose: Print a heading with the relevant columns -# Arguments: -# None -#################################################### -print_heading() -{ - if [ "${NOHEADER}" != "TRUE" ] - then - if [ "${QUIET}" != "TRUE" ] && [ "${ISSUER}" = "TRUE" ] && [ "${NAGIOS}" != "TRUE" ] && [ "${VALIDATION}" != "TRUE" ] - then - ${PRINTF} "\n%-35s %-17s %-8s %-11s %-4s\n" "Host" "Issuer" "Status" "Expires" "Days" - echo "----------------------------------- ----------------- -------- ----------- ----" - - elif [ "${QUIET}" != "TRUE" ] && [ "${ISSUER}" = "TRUE" ] && [ "${NAGIOS}" != "TRUE" ] && [ "${VALIDATION}" == "TRUE" ] - then - ${PRINTF} "\n%-35s %-35s %-32s %-17s\n" "Host" "Common Name" "Serial #" "Issuer" - echo "----------------------------------- ----------------------------------- -------------------------------- -----------------" - - elif [ "${QUIET}" != "TRUE" ] && [ "${NAGIOS}" != "TRUE" ] && [ "${VALIDATION}" != "TRUE" ] - then - ${PRINTF} "\n%-47s %-12s %-12s %-4s\n" "Host" "Status" "Expires" "Days" - echo "----------------------------------------------- ------------ ------------ ----" - - elif [ "${QUIET}" != "TRUE" ] && [ "${NAGIOS}" != "TRUE" ] && [ "${VALIDATION}" == "TRUE" ] - then - ${PRINTF} "\n%-35s %-35s %-32s\n" "Host" "Common Name" "Serial #" - echo "----------------------------------- ----------------------------------- --------------------------------" - fi - fi -} - - -########################################## -# Purpose: Describe how the script works -# Arguments: -# None -########################################## -usage() -{ - echo "Usage: $0 [ -e email address ] [ -x days ] [-q] [-a] [-b] [-h] [-i] [-n] [-v]" - echo " { [ -s common_name ] && [ -p port] } || { [ -f cert_file ] } || { [ -c certificate file ] }" - echo "" - echo " -a : Send a warning message through E-mail" - echo " -b : Will not print header" - echo " -c cert file : Print the expiration date for the PEM or PKCS12 formatted certificate in cert file" - echo " -e E-mail address : E-mail address to send expiration notices" - echo " -f cert file : File with a list of FQDNs and ports" - echo " -h : Print this screen" - echo " -i : Print the issuer of the certificate" - echo " -k password : PKCS12 file password" - echo " -n : Run as a Nagios plugin" - echo " -p port : Port to connect to (interactive mode)" - echo " -s commmon name : Server to connect to (interactive mode)" - echo " -q : Don't print anything on the console" - echo " -v : Only print validation data" - echo " -x days : Certificate expiration interval (eg. if cert_date < days)" - echo "" -} - - -########################################################################## -# Purpose: Connect to a server ($1) and port ($2) to see if a certificate -# has expired -# Arguments: -# $1 -> Server name -# $2 -> TCP port to connect to -########################################################################## -check_server_status() { - - - - if [ "_${2}" = "_smtp" -o "_${2}" = "_25" ] - then - TLSFLAG="-starttls smtp" - - elif [ "_${2}" = "_ftp" -o "_${2}" = "_21" ] - then - TLSFLAG="-starttls ftp" - - elif [ "_${2}" = "_pop3" -o "_${2}" = "_110" ] - then - TLSFLAG="-starttls pop3" - - elif [ "_${2}" = "_imap" -o "_${2}" = "_143" ] - then - TLSFLAG="-starttls imap" - - elif [ "_${2}" = "_submission" -o "_${2}" = "_587" ] - then - TLSFLAG="-starttls smtp -port ${2}" - else - TLSFLAG="" - fi - - echo "" | ${OPENSSL} s_client -connect ${1}:${2} ${TLSFLAG} 2> ${ERROR_TMP} 1> ${CERT_TMP} - - if ${GREP} -i "Connection refused" ${ERROR_TMP} > /dev/null - then - prints ${1} ${2} "Connection refused" "Unknown" - - elif ${GREP} -i "gethostbyname failure" ${ERROR_TMP} > /dev/null - then - prints ${1} ${2} "Cannot resolve domain" "Unknown" - - elif ${GREP} -i "Operation timed out" ${ERROR_TMP} > /dev/null - then - prints ${1} ${2} "Operation timed out" "Unknown" - - elif ${GREP} -i "ssl handshake failure" ${ERROR_TMP} > /dev/null - then - prints ${1} ${2} "SSL handshake failed" "Unknown" - - elif ${GREP} -i "connect: Connection timed out" ${ERROR_TMP} > /dev/null - then - prints ${1} ${2} "Connection timed out" "Unknown" - - else - check_file_status ${CERT_TMP} $1 $2 - fi -} - -##################################################### -### Check the expiration status of a certificate file -### Accepts three parameters: -### $1 -> certificate file to process -### $2 -> Server name -### $3 -> Port number of certificate -##################################################### -check_file_status() { - - CERTFILE=${1} - HOST=${2} - PORT=${3} - - ### Check to make sure the certificate file exists - if [ ! -r ${CERTFILE} ] || [ -z ${CERTFILE} ] - then - echo "ERROR: The file named ${CERTFILE} is unreadable or doesn't exist" - echo "ERROR: Please check to make sure the certificate for ${HOST}:${PORT} is valid" - RETCODE=1 - return - fi - - ### Grab the expiration date from the X.509 certificate - if [ "${PKCSDBPASSWD}" != "" ] - then - # Extract the certificate from the PKCS#12 database, and - # send the informational message to /dev/null - ${OPENSSL} pkcs12 -nokeys -in ${CERTFILE} \ - -out ${CERT_TMP} -password pass:${PKCSDBPASSWD} 2> /dev/null - - # Extract the expiration date from the certificate - CERTDATE=$(${OPENSSL} x509 -in ${CERT_TMP} -enddate -noout | \ - ${SED} 's/notAfter\=//') - - # Extract the issuer from the certificate - CERTISSUER=$(${OPENSSL} x509 -in ${CERT_TMP} -issuer -noout | \ - ${AWK} 'BEGIN {RS="/" } $0 ~ /^O=/ \ - { print substr($0,3,17)}') - - ### Grab the common name (CN) from the X.509 certificate - COMMONNAME=$(${OPENSSL} x509 -in ${CERT_TMP} -subject -noout | \ - ${SED} -e 's/.*CN=//' | \ - ${SED} -e 's/\/.*//') - - ### Grab the serial number from the X.509 certificate - SERIAL=$(${OPENSSL} x509 -in ${CERT_TMP} -serial -noout | \ - ${SED} -e 's/serial=//') - else - # Extract the expiration date from the ceriticate - CERTDATE=$(${OPENSSL} x509 -in ${CERTFILE} -enddate -noout | \ - ${SED} 's/notAfter\=//') - - # Extract the issuer from the certificate - CERTISSUER=$(${OPENSSL} x509 -in ${CERTFILE} -issuer -noout | \ - ${AWK} 'BEGIN {RS="/" } $0 ~ /^O=/ { print substr($0,3,17)}') - - ### Grab the common name (CN) from the X.509 certificate - COMMONNAME=$(${OPENSSL} x509 -in ${CERTFILE} -subject -noout | \ - ${SED} -e 's/.*CN=//' | \ - ${SED} -e 's/\/.*//') - ### Grab the serial number from the X.509 certificate - SERIAL=$(${OPENSSL} x509 -in ${CERTFILE} -serial -noout | \ - ${SED} -e 's/serial=//') - fi - - ### Split the result into parameters, and pass the relevant pieces to date2julian - set -- ${CERTDATE} - MONTH=$(getmonth ${1}) - - # Convert the date to seconds, and get the diff between NOW and the expiration date - CERTJULIAN=$(date2julian ${MONTH#0} ${2#0} ${4}) - CERTDIFF=$(date_diff ${NOWJULIAN} ${CERTJULIAN}) - - if [ ${CERTDIFF} -lt 0 ] - then - if [ "${ALARM}" = "TRUE" ] - then - echo "The SSL certificate for ${HOST} \"(CN: ${COMMONNAME})\" has expired!" \ - | ${MAIL} -s "Certificate for ${HOST} \"(CN: ${COMMONNAME})\" has expired!" ${ADMIN} - fi - - prints ${HOST} ${PORT} "Expired" "${CERTDATE}" "${CERTDIFF}" "${CERTISSUER}" "${COMMONNAME}" "${SERIAL}" - RETCODE=2 - - elif [ ${CERTDIFF} -lt ${WARNDAYS} ] - then - if [ "${ALARM}" = "TRUE" ] - then - echo "The SSL certificate for ${HOST} \"(CN: ${COMMONNAME})\" will expire on ${CERTDATE}" \ - | ${MAIL} -s "Certificate for ${HOST} \"(CN: ${COMMONNAME})\" will expire in ${WARNDAYS}-days or less" ${ADMIN} - fi - prints ${HOST} ${PORT} "Expiring" "${CERTDATE}" "${CERTDIFF}" "${CERTISSUER}" "${COMMONNAME}" "${SERIAL}" - RETCODE=1 - - else - prints ${HOST} ${PORT} "Valid" "${CERTDATE}" "${CERTDIFF}" "${CERTISSUER}" "${COMMONNAME}" "${SERIAL}" - RETCODE=0 - fi -} - -################################# -### Start of main program -################################# -while getopts abinve:f:c:hk:p:s:qx: option -do - case "${option}" - in - a) ALARM="TRUE";; - b) NOHEADER="TRUE";; - c) CERTFILE=${OPTARG};; - e) ADMIN=${OPTARG};; - f) SERVERFILE=$OPTARG;; - h) usage - exit 1;; - i) ISSUER="TRUE";; - k) PKCSDBPASSWD=${OPTARG};; - n) NAGIOS="TRUE";; - p) PORT=$OPTARG;; - s) HOST=$OPTARG;; - q) QUIET="TRUE";; - v) VALIDATION="TRUE";; - x) WARNDAYS=$OPTARG;; - \?) usage - exit 1;; - esac -done - -if [ -f /usr/bin/mailx ] -then - MAIL="/usr/bin/mailx" -else - if [ "${ALARM}" == "FALSE" ] - then - MAIL=$(which mail 2>/dev/null) - else - MAIL=$(which mail) - fi -fi - - -### Check to make sure a openssl utility is available -if [ ! -f ${OPENSSL} ] -then - echo "ERROR: The openssl binary does not exist in ${OPENSSL}." - echo "FIX: Please modify the \${OPENSSL} variable in the program header." - exit 1 -fi - -### Check to make sure a date utility is available -if [ ! -f ${DATE} ] -then - echo "ERROR: The date binary does not exist in ${DATE} ." - echo "FIX: Please modify the \${DATE} variable in the program header." - exit 1 -fi - -### Check to make sure a grep utility is available -if [ ! -f ${GREP} ] -then - echo "ERROR: The grep binary does not exist in ${GREP} ." - echo "FIX: Please modify the \${GREP} variable in the program header." - exit 1 -fi - -### Check to make sure the mktemp and printf utilities are available -if [ ! -f ${MKTEMP} ] || [ ! -f ${PRINTF} ] -then - echo "ERROR: Unable to locate the mktemp or printf binary." - echo "FIX: Please modify the \${MKTEMP} and \${PRINTF} variables in the program header." - exit 1 -fi - -### Check to make sure the sed and awk binaries are available -if [ ! -f ${SED} ] || [ ! -f ${AWK} ] -then - echo "ERROR: Unable to locate the sed or awk binary." - echo "FIX: Please modify the \${SED} and \${AWK} variables in the program header." - exit 1 -fi - -### CHeck to make sure a mail client is available it automated notifcations are requested -if [ "${ALARM}" = "TRUE" ] && [ ! -f ${MAIL} ] -then - echo "ERROR: You enabled automated alerts, but the mail binary could not be found." - echo "FIX: Please modify the ${MAIL} variable in the program header." - exit 1 -fi - -# Place to stash temporary files -CERT_TMP=$($MKTEMP /var/tmp/cert.XXXXXX) -ERROR_TMP=$($MKTEMP /var/tmp/error.XXXXXX) - -### Baseline the dates so we have something to compare to -MONTH=$(${DATE} "+%m") -DAY=$(${DATE} "+%d") -YEAR=$(${DATE} "+%Y") -NOWJULIAN=$(date2julian ${MONTH#0} ${DAY#0} ${YEAR}) - -### Touch the files prior to using them -if [ ! -z "${CERT_TMP}" ] && [ ! -z "${ERROR_TMP}" ] -then - touch ${CERT_TMP} ${ERROR_TMP} -else - echo "ERROR: Problem creating temporary files" - echo "FIX: Check that mktemp works on your system" - exit 1 -fi - -### If a HOST and PORT were passed on the cmdline, use those values -if [ "${HOST}" != "" ] && [ "${PORT}" != "" ] -then - print_heading - check_server_status "${HOST}" "${PORT}" - -### If a file is passed to the "-f" option on the command line, check -### each certificate or server / port combination in the file to see if -### they are about to expire -elif [ -f "${SERVERFILE}" ] -then - print_heading - while read HOST PORT - do - if [ "`echo ${HOST} | cut -c1`" = "#" ] - then - : - elif [ "$PORT" = "FILE" ] - then - check_file_status ${HOST} "FILE" "${HOST}" - else - check_server_status "${HOST}" "${PORT}" - fi - - done < ${SERVERFILE} - -### Check to see if the certificate in CERTFILE is about to expire -elif [ "${CERTFILE}" != "" ] -then - print_heading - check_file_status ${CERTFILE} "FILE" "${CERTFILE}" - -### There was an error, so print a detailed usage message and exit -else - usage - exit 1 -fi - -### Remove the temporary files -rm -f ${CERT_TMP} ${ERROR_TMP} - -### Exit with a success indicator -if [ "${NAGIOS}" = "TRUE" ]; then - exit $RETCODE -else - exit 0 -fi diff --git a/start-streaming b/start-streaming index b324c55..feff8a4 100755 --- a/start-streaming +++ b/start-streaming @@ -1,12 +1,15 @@ #!/bin/bash # -# thanks to rafael at riseup.net and -# http://current.workingdirectory.net/posts/2010/video4linux-and-audio/ -# http://mcs.hackitectura.net/tiki-index.php?page=live+stream+with+gstreamer -# https://en.wikibooks.org/wiki/Puredyne/Stream_Audio_and_Video#Gstreamer -# http://wm161.net/2011/03/02/anchorman/ +# GStreamer command line wrapper # -# needed packages: v4l-utils gstreamer-tools +# Thanks to rafael at riseup.net and the following documents: +# +# http://current.workingdirectory.net/posts/2010/video4linux-and-audio/ +# http://mcs.hackitectura.net/tiki-index.php?page=live+stream+with+gstreamer +# https://en.wikibooks.org/wiki/Puredyne/Stream_Audio_and_Video#Gstreamer +# http://wm161.net/2011/03/02/anchorman/ +# +# Needed packages: v4l-utils gstreamer-tools # # Example config: # @@ -1,6 +1,6 @@ #!/bin/bash # -# terminal: terminal emulator wrapper +# Terminal emulator wrapper # source ~/.geometry || exit 1 @@ -1,6 +1,6 @@ #!/bin/bash # -# worklog wrapper +# Worklog wrapper # BASE="$HOME/grupos" diff --git a/tor-browser b/tor-browser index 678fa23..6ad669e 100755 --- a/tor-browser +++ b/tor-browser @@ -1 +1,5 @@ +# +# Wrapper for the Tor Software Bundle +# + $HOME/apps/tor-browser/`uname -m`/start-tor-browser @@ -1,5 +1,5 @@ # -# Workscreen: screen session wrapper. +# Workscreen: screen session wrapper # # Default options. @@ -1,6 +1,6 @@ #!/bin/bash # -# start multiple conky instances +# Start multiple conky instances # # Default one @@ -1,3 +1,7 @@ #!/bin/bash +# +# Hibernate computer +# + xlock & sudo pm-hibernate @@ -1,16 +0,0 @@ -#!/bin/bash -# -# xirssi: execute irssi under a terminal -# - -source ~/.geometry || exit 1 - -#Eterm --background-pixmap 0 --scrollbar 0 +sb -b black -f white -F vga --borderless no --buttonbar 0 \ -# -g 120x40+30+55 -nIrssi -e irssi - -#Eterm --background-pixmap 0 --scrollbar 0 +sb -b black -f white \ -# -F $FONT --borderless no --buttonbar 0 \ -# -g $GEOMETRY -nirssi -e irssi -#rxvt-unicode -bg black +sb -fg white -fn $FONT -g $GEOMETRY -title irssi -e irssi - -xterm -u8 -fn $FONT -geometry $GEOMETRY -e irssi @@ -1 +1,6 @@ +#!/bin/bash +# +# Lock the screen using xscreensaver +# + xscreensaver-command --lock @@ -1,16 +0,0 @@ -#!/bin/bash -# -# xmutt: wrapper for mutt -# - -source ~/.geometry || exit 1 - -# Using rxvt -#rxvt -geometry 110x45 -fn 7x13 -e mutt -#rxvt -g 110x45+320+90 +sb -fn smooth -name mutt -e mutt - -# Using Eterm -#Eterm -g $GEOMETRY +sb -f white -F $FONT --borderless no --buttonbar 0 \ -# --scrollbar 0 -P $HOME/themes/ground.jpg@:scaled -e mutt -nmutt - -xterm -u8 -fn $FONT -geometry $GEOMETRY -title mutt -e mutt @@ -1,3 +1,7 @@ #!/bin/bash +# +# Activate software suspend +# + xlock & sudo pm-suspend |