Skip to content

Instantly share code, notes, and snippets.

View nobrowser's full-sized avatar

Ian Zimmerman nobrowser

View GitHub Profile
@nobrowser
nobrowser / lemonbar-source.pl
Created July 9, 2019 01:23
Script to feed lemonbar, with as few external processes as possible
#! /bin/sh localperl
# This is now a -*-Perl-*- script
use strict;
use warnings;
use File::Slurp;
use POSIX qw(strftime);
use X11::Xlib;
use X11::Xlib::Display;
@nobrowser
nobrowser / perlsuck.pl
Last active December 9, 2018 07:00
Perl code to download netnews articles via NNTP in batch
#! /usr/bin/env perl
use strict;
use warnings;
use Net::NNTP;
use Getopt::Long qw(:config no_permute);
use Fcntl;
$main::usage = <<'EOF'
@nobrowser
nobrowser / message-id-filter.pl
Created November 21, 2018 23:57
Run a mail search program and get message-ids from result filenames
#! /usr/bin/env perl
use strict;
my $indexer = $ENV{'MAIL_INDEXER'} || 'mairix';
sub snag_msgid {
open (my $mail, "<$_[0]");
if (!$mail) {
warn("failed to open $_[0]: $!");
@nobrowser
nobrowser / grokplaces.sh
Created October 23, 2017 21:12
Replicate palemoon (and firefox?) places database
#! /bin/sh -Cefu
. /usr/local/etc/foolinux-pathconfig ; . $FOOLINUX_BIN_PATH/mashlib.sh
PROFILE=${1:-default}
vconc PROFILEDIR $HOME '/.moonchild productions/pale moon/' $PROFILE .profile
vconc PLACES $PROFILEDIR / places.sqlite
vconc PLACESWAL $PLACES -wal
vconc PLACESSHM $PLACES -shm
#! /bin/sh -Cefu
. /usr/local/bin/mashlib.sh
vconc OPAM $HOME /bin/opam
vconc REALPROG $HOME /.opam/ $($OPAM switch show) /bin/ocamlbuild
CURDIR=$PWD
while : ; do
if exists $PWD/_tags ; then break ; fi
@nobrowser
nobrowser / cron.py
Last active September 29, 2017 15:28
Save wireless neighborhood scans to a database
#! /usr/bin/python3
import sys
import subprocess as SP
import json
import time
import sqlite3 as SQL
DIRECT_FIELDS = 'address essid quality channel encrypted wpa wpa2'.split();
DIRECT_PLACES = [':' + df for df in DIRECT_FIELDS]
@nobrowser
nobrowser / pmtw.sh
Created January 25, 2017 23:30
Mount removable drives in a quick and flexible way from the command line
#! /bin/sh -Cefu
. /usr/local/bin/fortify.sh
. /usr/local/bin/mashlib.sh
MODE=name
usage()
{
echo 'usage: pmtw ( NAME | -u UUID | -l LABEL | -p PARTITION )' >&2
@nobrowser
nobrowser / savestream.sh
Last active January 5, 2017 03:35
A script to rip a web audio stream and save it to a file.
#! /bin/sh -Cefu
. /usr/local/bin/fortify.sh
. /usr/local/bin/mashlib.sh
MYLOGIN=$(id -un)
HOME=$(conc /home/ $MYLOGIN)
# defaults possibly overriden by config file
DESTDIR=$(conc $HOME /music/streams/croddur)
@nobrowser
nobrowser / kmp.v
Created July 30, 2016 02:25
Coq development to state the correctness of Knuth-Morris-Pratt string matching. A bit abortive so far :-)
Require Import Utf8.
Require Import Coq.Vectors.Fin.
Require Import Coq.Lists.List.
Open Scope list_scope.
Import ListNotations.