summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--brscan-key.pl152
-rwxr-xr-xdecode-barcode4
-rwxr-xr-xgitBlameFromLineNo24
-rwxr-xr-xminecraft3
-rwxr-xr-xraid-check5
m---------remotes/falconindy-bin0
-rwxr-xr-xscreen-locker.sh14
-rwxr-xr-xsuspend-resume.sh4
8 files changed, 198 insertions, 8 deletions
diff --git a/brscan-key.pl b/brscan-key.pl
new file mode 100644
index 0000000..34f0ba8
--- /dev/null
+++ b/brscan-key.pl
@@ -0,0 +1,152 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use threads;
+
+package BRscan::Config;
+our $port = 54925;
+our $printer = "192.168.4.42";
+our $myip = "192.168.4.247";
+our $debug = 1;
+our $work_dir = "/mnt/levant/nfs/tmp";
+
+package BRscan::Listener;
+use IO::Socket;
+use feature qw/switch/;
+#use Data::Dumper;
+
+sub run {
+ my $max_len = 2048;
+ our $debug = $BRscan::Config::debug;
+ my $msg;
+ my @processed;
+
+ my $sock = IO::Socket::INET->new(LocalPort => $BRscan::Config::port, Proto => 'udp') or die "socket: $@";
+
+ while ($sock->recv($msg, $max_len)) {
+ my $cport = $sock->peerport();
+ my $chost = $sock->peerhost();
+
+ print STDERR "Client $chost:$cport said: $msg\n" if $debug;
+
+ # discard first 4 bytes, probably not relevant
+ # TODO: what do they mean?
+ $msg = substr($msg, 4);
+
+ my %fields;
+
+ for my $field (split(/;/, $msg)) {
+ my ($key, $value) = split(/=/, $field);
+ next unless defined($key) and defined($value);
+
+ print STDERR "key: \"$key\"; value: \"$value\"\n" if $debug;
+
+ $fields{$key} = $value;
+ }
+
+ # BR likely stands for "brother". use this to determine if it's really a request from a brother device
+ next unless $fields{TYPE} eq "BR";
+
+ # ignore multiple requests
+ # TODO: clean up old ids
+ my $id = $fields{REGID}."-".$fields{SEQ};
+ if ($id ~~ @processed) {
+ print STDERR "already processed $id. skipping...\n" if $debug;
+ next;
+ }
+
+ # we only handle the scan button
+ next unless $fields{BUTTON} eq "SCAN";
+
+ print STDERR "got $fields{FUNC} scan request\n" if $debug;
+
+ # possible values: FILE, IMAGE, OCR, EMAIL
+ given ($fields{FUNC}) {
+ when (/IMAGE/) {
+ system("scan-multi");
+ }
+ when (/FILE/) {
+ system("scan-multi --pdf");
+ }
+ }
+
+ push @processed, $id;
+ print STDERR "finished processing $id\n";
+ }
+}
+
+package BRscan::RegWatcher;
+use Net::SNMP;
+
+sub run {
+ our $debug = $BRscan::Config::debug;
+ my ($session, $error) = Net::SNMP->session(
+ -community => "internal",
+ -version => 1,
+ -hostname => $BRscan::Config::printer,
+ );
+
+ if (!defined $session) {
+ printf STDERR "ERROR: %s.\n", $error;
+
+ exit 1;
+ }
+
+ # unhandled are commented out
+ my @apps = (
+ {appnum => 1, func => "IMAGE"},
+ #{appnum => 2, func => "EMAIL"},
+ #{appnum => 3, func => "OCR"},
+ {appnum => 5, func => "FILE"},
+ );
+
+ my @varbindlist;
+
+ for my $app (@apps) {
+ push @varbindlist, "1.3.6.1.4.1.2435.2.3.9.2.11.1.1.0";
+ push @varbindlist, OCTET_STRING;
+ push @varbindlist, "TYPE=BR;BUTTON=SCAN;USER=".$ENV{USER}.";FUNC=".$app->{"func"}.";HOST=".$BRscan::Config::myip.":".$BRscan::Config::port.";APPNUM=".$app->{"appnum"}.";DURATION=360;BRID=;";
+ }
+
+ @apps = undef;
+
+ while (1) {
+ print STDERR "sending snmp set_request\n" if $debug;
+
+ my $result = $session->set_request(-varbindlist => \@varbindlist);
+
+ if (!defined $result) {
+ printf "ERROR in set_request: %s.\n", $session->error();
+ }
+
+ sleep 60;
+ }
+}
+
+package main;
+our $debug = $BRscan::Config::debug;
+
+chdir("$BRscan::Config::work_dir");
+
+threads->new("BRscan::Listener::run");
+threads->new("BRscan::RegWatcher::run");
+
+# wait for everyone before exiting
+foreach my $thr (threads->list) {
+ if ($thr->tid && !threads::equal($thr, threads->self)) {
+ print "waiting for thread ".$thr->tid()." to finish\n" if $debug;
+ $thr->join;
+ }
+}
+
+__END__
+
+=head1 NAME
+
+brscan-key.pl - Deamon for brother scanner key
+
+=head1 DESCRIPTION
+
+This daemon registers itself with a brother scanner and accepts incoming scanning requests.
+
+=cut
diff --git a/decode-barcode b/decode-barcode
new file mode 100755
index 0000000..4d16780
--- /dev/null
+++ b/decode-barcode
@@ -0,0 +1,4 @@
+#!/bin/sh
+file=$(scrot -s -e 'echo $f')
+zbarimg --raw $file
+rm "$file"
diff --git a/gitBlameFromLineNo b/gitBlameFromLineNo
new file mode 100755
index 0000000..432e3fa
--- /dev/null
+++ b/gitBlameFromLineNo
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use v5.10;
+
+my $debug = 0;
+
+my $line_no = $ARGV[0];
+my $file_name = $ARGV[1];
+say "Line: $line_no | File: $file_name" if $debug;
+
+# Get the git blame for the line & file
+my $line = `git blame -L $line_no,$line_no $file_name`;
+say "Line: $line" if $debug;
+
+# Reduce this just to the SHA
+chomp $line;
+(my $sha = $line) =~ s/^(\S+).*/$1/;
+say "SHA: $sha" if $debug;
+
+# Show the commit for that SHA
+system("git show $sha"); \ No newline at end of file
diff --git a/minecraft b/minecraft
new file mode 100755
index 0000000..35f418f
--- /dev/null
+++ b/minecraft
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+LD_LIBRARY_PATH="$JAVA_HOME/lib/amd64" mumble-overlay java -cp ~/minecraft/minecraft.jar net.minecraft.LauncherFrame
diff --git a/raid-check b/raid-check
new file mode 100755
index 0000000..2b7f7f2
--- /dev/null
+++ b/raid-check
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+for f in /sys/block/md*/md/sync_action; do
+ echo check > $f
+done
diff --git a/remotes/falconindy-bin b/remotes/falconindy-bin
-Subproject 92d8ab28192919ea3d3fd60e3be595f06f7a1e0
+Subproject 5bf3d6db10f439690b23e6ac67a3474dbea747b
diff --git a/screen-locker.sh b/screen-locker.sh
index d0eb820..efb3dbb 100755
--- a/screen-locker.sh
+++ b/screen-locker.sh
@@ -10,18 +10,20 @@
#----------------------------------------------------
lock () {
- gajim-remote change_status away &
- echo "command /away afk" | ssh mistral 'socat stdin unix-connect:.irssi/socket'
- xset dpms 5 5 5
- slock
+# gajim-remote change_status away &
+# echo "command /away afk" | ssh mistral 'socat stdin unix-connect:.irssi/socket'
+ xset dpms 2 2 2
+# i3lock -n -t -i ~flo/backgrounds/lockscreen.png
+ slock
}
unlock () {
xset dpms 0 0 0
- gajim-remote change_status online &
- echo "command /away" | ssh mistral 'socat stdin unix-connect:.irssi/socket'
+# gajim-remote change_status online &
+# echo "command /away" | ssh mistral 'socat stdin unix-connect:.irssi/socket'
}
+#if pidof i3lock &> /dev/null; then exit 1; fi
if pidof slock &> /dev/null; then exit 1; fi
(lock && unlock) &
diff --git a/suspend-resume.sh b/suspend-resume.sh
index 6b60a14..a204075 100755
--- a/suspend-resume.sh
+++ b/suspend-resume.sh
@@ -7,5 +7,5 @@ xset r rate 250 50 &
source $HOME/bin/gpg-agent.sh
numlockx
#(sleep 10 && ossxmix -b) &
-(sleep 15 && ~/bin/irssi_notify.sh < /dev/null) &
-(sleep 5 && xmodmap ~/.xmodmaprc) &
+#(sleep 15 && ~/bin/irssi_notify.sh < /dev/null) &
+#(sleep 5 && xmodmap ~/.xmodmaprc) &