From: Andrew DeFaria Date: Fri, 22 Apr 2022 16:56:33 +0000 (-0700) Subject: Merge branch 'master' of git+ssh://github.com/adefaria/clearscm X-Git-Url: https://defaria.com/gitweb/?a=commitdiff_plain;h=67781e311ebed78e2540360784f95cb7aac9ae2f;hp=8544f15966dec66fdb058a62c34ec39f94361b99;p=clearscm.git Merge branch 'master' of git+ssh://github.com/adefaria/clearscm --- diff --git a/bin/announceEmail.pl b/bin/announceEmail.pl index a864634..cb6667b 100755 --- a/bin/announceEmail.pl +++ b/bin/announceEmail.pl @@ -75,9 +75,10 @@ use warnings; use FindBin; use Getopt::Long; -use Pod::Usage; use Mail::IMAPTalk; use MIME::Base64; +use Pod::Usage; +use Proc::ProcessTable; use lib "$FindBin::Bin/../lib"; @@ -89,6 +90,16 @@ use Utils; local $0 = "$FindBin::Script " . join ' ', @ARGV; +my $processes = Proc::ProcessTable->new; + +for my $process (@{$processes->table}) { + if ($process->cmndline eq $0 and $process->pid != $$) { + verbose "$FindBin::Script already running"; + + exit 0; + } # if +} # for + my $defaultIMAPServer = 'defaria.com'; my $IMAP; my %unseen; diff --git a/bin/capture-area.sh b/bin/capture-area.sh index 4ed0f95..5197f95 100755 --- a/bin/capture-area.sh +++ b/bin/capture-area.sh @@ -1,2 +1,17 @@ #!/bin/bash -gnome-screenshot -caf /System/tmp/Screenshot-$(date +%F@%T).png +timeout=10 +screenshot_directory=/tmp + +function yesno { + question=$1 + + zenity --question --text "$question" --width=300 --timeout=$timeout 2> /dev/null +} + +mate-screenshot -ac + +file="$screenshot_directory/Screenshots/$(date +%F@%T).png + +if yesno "Save screenshot as $file?"; then + xclip -selection clipboard -t image/png -o > $file +fi diff --git a/bin/capture-window.sh b/bin/capture-window.sh index 46ad937..126b8e4 100755 --- a/bin/capture-window.sh +++ b/bin/capture-window.sh @@ -1,2 +1,17 @@ #!/bin/bash -gnome-screenshot -cwf /System/tmp/Screenshot-$(date +%F@%T).png +timeout=10 +screenshot_directory=/tmp + +function yesno { + question=$1 + + zenity --question --text "$question" --width=300 --timeout=$timeout 2> /dev/null +} + +mate-screenshot -wc + +file=$screenshot_directory/Screenshots/$(date +%F@%T).png + +if yesno "Save screenshot as $file?"; then + xclip -selection clipboard -t image/png -o > $file +fi diff --git a/bin/lightsout.sh b/bin/lightsout.sh index bd09301..126f943 100755 --- a/bin/lightsout.sh +++ b/bin/lightsout.sh @@ -9,11 +9,11 @@ if [ "$1" = "-a" ]; then fi fi -if [ $host = "earth" ]; then +#if [ $host = "earth" ]; then export DISPLAY=:1 -else - export DISPLAY=:0 -fi +#else +# export DISPLAY=:0 +#fi sleep 2 /usr/local/bin/setdpms.sh diff --git a/bin/setbg b/bin/setbg index 85479a5..b64024c 100755 --- a/bin/setbg +++ b/bin/setbg @@ -73,6 +73,7 @@ Uploads is included and new pictures can arrive everyday. use strict; use warnings; +use experimental qw(signatures); use FindBin; use Getopt::Long; @@ -150,28 +151,29 @@ sub fillPictures () { return @images; } # fillPictures -sub writeHistory($) { - my ($msg) = @_; - +sub writeHistory($msg) { open my $hist, '>>', "$ENV{HOME}/.$FindBin::Script.hist" or error "Unable to open $ENV{HOME}/.$FindBin::Script.hist for append - $!", 1; $msg = localtime() . $msg; - display $msg, $hist; + print $hist $msg; close $hist; } # writeHistory -sub updateSetBG($$) { - my ($bgimage, $lockimage) = @_; +sub writeSetBG ($filename, $image) { + open my $file, '>', $filename + or error "Unable to open $filename for writing - $!", 1; - open my $setbg, '>', "$ENV{HOME}/.$FindBin::Script" - or error "Unable to open $ENV{HOME}/.$FindBin::Script for writing - $!", 1; + print $file "$image\n"; - display $bgimage, $setbg; + close $file; +} # writeSetBG - close $setbg; +sub updateSetBG($bgimage, $lockimage) { + writeSetBG "$ENV{HOME}/.$FindBin::Script", $bgimage; + writeSetBG "$ENV{HOME}/.$FindBin::Script.lock", $lockimage; my $msg = ":$bgimage"; $msg .= " lock:$lockimage" if $opts{lockscreen}; @@ -231,7 +233,7 @@ my ($setbgOpts, $setLockOpts); if ($opts{mate}) { $setbgOpts = 'set org.mate.background picture-filename '; - $setLockOpts = 'set org.mate.background picture-filename '; + $setLockOpts = 'set org.mate.screensaver picture-filename '; } else { $setbgOpts = "set org.gnome.desktop.background picture-uri \"file://"; $setLockOpts = "set org.gnome.desktop.screensaver picture-uri \"file://"; diff --git a/bin/updateCalendar.sh b/bin/updateCalendar.sh index 50b50ef..0f0d40b 100755 --- a/bin/updateCalendar.sh +++ b/bin/updateCalendar.sh @@ -1,12 +1,7 @@ #!/bin/bash -# Odd. Seems the following causes wget to use IPv6 instead of IPv4. Well -# recently we turned off IPv6 because we suspect this causes our WiFi -# dropout problem. But then this hangs. -#wget -O /tmp/calendar.$$.ics 'https://www.google.com/calendar/ical/adefaria%40gmail.com/public/basic.ics' >> /tmp/updateCalendar.$$.log 2>&1 -wget --no-check-certificate -O /tmp/calendar.$$.ics 'https://172.217.11.174/calendar/ical/adefaria%40gmail.com/public/basic.ics' >> /tmp/updateCalendar.$$.log 2>&1 +wget -O /tmp/calendar.$$.ics https://calendar.google.com/calendar/ical/adefaria%40gmail.com/public/basic.ics > /tmp/updateCalendar.$$.log 2>&1 wget -O /tmp/meetups.$$.ics 'http://www.meetup.com/events/ical/10426135/8dfdd0ffaaedecf720c5faf0cf3871b7ee5f5c1e/going' >> /tmp/updateCalendar.$$.log 2>&1 - wget -4 -O /tmp/tripit.$$.ics 'http://www.tripit.com/feed/ical/private/06C4F90D-EFEFB9C5FDB17EC5FCB327DE31A54D96/tripit.ics' >> /tmp/updateCalendar.$$.log 2>&1 # Now let's combine the files. First strip off the END:CALENDAR from the main diff --git a/rc/bash_login b/rc/bash_login index b587baf..4596387 100644 --- a/rc/bash_login +++ b/rc/bash_login @@ -326,11 +326,6 @@ set_prompt # Set display to local export DISPLAY=${DISPLAY:-:0} -# New tmp location -if [ -d /System/tmp ]; then - export TMP=/System/tmp -fi - # Reset home in case it changed HOME=$saved_home diff --git a/rc/sshconfig b/rc/sshconfig index fd83394..6b6598f 100644 --- a/rc/sshconfig +++ b/rc/sshconfig @@ -1,11 +1,11 @@ StrictHostKeyChecking no LogLevel ERROR -Host mars earth home defaria.com +Host mars earth home defaria.com sandboxu ForwardX11 yes ForwardX11Trusted yes -Host jupiter cpanel github.com sandbox sandboxal sandboxu +Host jupiter cpanel github.com sandbox sandboxal ForwardX11 no ForwardX11Trusted no @@ -32,9 +32,6 @@ Host sandboxal Hostname 10.2.99.106 IdentityFile ~/.ssh/cpanelkey -Host enterprise.cpanel.net - IdentityFile ~/.ssh/cpanelkey - Host 10.2.* sandbox* ForwardAgent yes StrictHostKeyChecking no