URI: 
       tadd vipe; misc fixes - scripts - random scripts
  HTML git clone git://parazyd.org/scripts.git
   DIR Log
   DIR Files
   DIR Refs
       ---
   DIR commit e46c23f80627e322524c87cec39653b291110188
   DIR parent a273b639954b5945a096323ad9f102427437b7ca
  HTML Author: parazyd <parazyd@dyne.org>
       Date:   Mon, 13 Mar 2017 11:52:04 +0100
       
       add vipe; misc fixes
       
       Diffstat:
         M auphone                             |       2 +-
         M qemu-kvm                            |      15 ++++++++++++++-
         A scan_domains.py                     |      19 +++++++++++++++++++
         M touchpad-toggle                     |       2 +-
         A vipe                                |      74 +++++++++++++++++++++++++++++++
       
       5 files changed, 109 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/auphone b/auphone
       t@@ -5,7 +5,7 @@ if [ $1 ]
        then
                OTHER=$1
        else
       -        echo "Use $O to talk with someone..." && exit 1
       +        echo "Use $0 to talk with someone..." && exit 1
        fi
        AUARGS="-b 1 -r 11000 -e u8"
        
   DIR diff --git a/qemu-kvm b/qemu-kvm
       t@@ -1,2 +1,15 @@
        #!/bin/dash
       -exec qemu-system-x86_64 -enable-kvm $@
       +
       +case "$1" in
       +        amd*)
       +                shift
       +                exec qemu-system-x86_64 -enable-kvm "$@"
       +                ;;
       +        i386)
       +                shift
       +                exec qemu-system-i386 -enable-kvm "$@"
       +                ;;
       +        *)
       +                exec qemu-system-x86_64 -enable-kvm "$@"
       +                ;;
       +esac
   DIR diff --git a/scan_domains.py b/scan_domains.py
       t@@ -0,0 +1,19 @@
       +#!/usr/bin/env python2
       +# Search for domain names to find cool ones.
       +import os, sys
       +
       +site_exists = lambda site: \
       +    os.system("whois %s.com | grep \"No match\" > /dev/null"%site) != 0
       +
       +alphabet = map(chr, range(ord('a'), ord('z') + 1))
       +
       +for i in alphabet:
       +    for j in alphabet:
       +        for k in alphabet:
       +            site_name = i + j + k
       +            print 'Trying', site_name
       +            if not site_exists(site_name):
       +                print '#################'
       +                print 'Winner!', site_name
       +                print '#################'
       +sys.exit(0)
   DIR diff --git a/touchpad-toggle b/touchpad-toggle
       t@@ -1,6 +1,6 @@
        #!/bin/sh
        
       -if [ $(synclient -l | grep TouchpadOff | mawk -F '= ' '{ print $2 }') -eq 0 ];
       +if [ $(synclient -l | mawk -F '= ' '/TouchpadOff/ { print $2 }') -eq 0 ];
        then
                synclient TouchpadOff=1
        else
   DIR diff --git a/vipe b/vipe
       t@@ -0,0 +1,74 @@
       +#!/usr/bin/perl
       +
       +=head1 NAME
       +
       +vipe - edit pipe
       +
       +=head1 SYNOPSIS
       +
       +command1 | vipe | command2
       +
       +=head1 DESCRIPTION
       +
       +vipe allows you to run your editor in the middle of a unix pipeline and
       +edit the data that is being piped between programs. Your editor will
       +have the full data being piped from command1 loaded into it, and when you
       +close it, that data will be piped into command2.
       +
       +=head1 ENVIRONMENT VARIABLES
       +
       +=over 4
       +
       +=item EDITOR
       +
       +Editor to use.
       +
       +=item VISUAL
       +
       +Also supported to determine what editor to use.
       +
       +=back
       +
       +=head1 AUTHOR
       +
       +Copyright 2006 by Joey Hess <id@joeyh.name>
       +
       +Licensed under the GNU GPL.
       +
       +=cut
       +
       +use warnings;
       +use strict;
       +use File::Temp q{tempfile};
       +
       +$/=undef;
       +
       +my ($fh, $tmp)=tempfile();
       +die "cannot create tempfile" unless $fh;
       +print ($fh <STDIN>) || die "write temp: $!";
       +close $fh;
       +close STDIN;
       +open(STDIN, "</dev/tty") || die "reopen stdin: $!";
       +open(OUT, ">&STDOUT") || die "save stdout: $!";
       +close STDOUT;
       +open(STDOUT, ">/dev/tty") || die "reopen stdout: $!";
       +
       +my @editor="vi";
       +if (-x "/usr/bin/editor") {
       +        @editor="/usr/bin/editor";
       +}
       +if (exists $ENV{EDITOR}) {
       +        @editor=split(' ', $ENV{EDITOR});
       +}
       +if (exists $ENV{VISUAL}) {
       +        @editor=split(' ', $ENV{VISUAL});
       +}
       +my $ret=system(@editor, $tmp);
       +if ($ret != 0) {
       +        die "@editor exited nonzero, aborting\n";
       +}
       +
       +open (IN, $tmp) || die "$0: cannot read $tmp: $!\n";
       +print (OUT <IN>) || die "write failure: $!";
       +close IN;
       +unlink($tmp);