From f2cdfeba2b9b55e764d7403037ad69ca76b30b42 Mon Sep 17 00:00:00 2001 From: Ev Bogdanov Date: Wed, 16 Aug 2017 13:54:35 +0300 Subject: [PATCH] Delete a bunch of scripts --- README.md | 14 +++-------- bin/a+ | 38 ----------------------------- bin/cc+ | 5 ---- bin/cc- | 7 ------ bin/d | 5 ---- bin/eman | 9 ------- bin/erun | 47 ------------------------------------ bin/put+ | 72 ------------------------------------------------------- bin/w+ | 63 ------------------------------------------------ 9 files changed, 3 insertions(+), 257 deletions(-) delete mode 100755 bin/a+ delete mode 100755 bin/cc+ delete mode 100755 bin/cc- delete mode 100755 bin/d delete mode 100755 bin/eman delete mode 100755 bin/erun delete mode 100755 bin/put+ delete mode 100755 bin/w+ diff --git a/README.md b/README.md index eab02c2..06ed970 100644 --- a/README.md +++ b/README.md @@ -82,30 +82,22 @@ I spawn Acme by running `a` script. Who is who in **bin** directory: - `a` start Acme -- `a+ SYMBOL` alignment (default is fat comma: `|a+ '=>'`, erlang proplist: `|a+ ' '`) - `c+ SYMBOL` add comment (python: `|c+` or `|c+ '#'`, erlang: `|c+ %`, js: `|c+ //`) - `c- SYMBOL` delete comment (python/erlang: `|c-`, js: `|c- //`) -- `cc+` snake_case to CamelCase -- `cc-` CamelCase to snake_case -- `d` works like `Edit , d` -- `eman MODULE` shortcut for `erl -man MODULE` (displays the manual page for the Erlang module MODULE) -- `erun MODULE ARG1 ... ARGN` erlangish `go run` - `g+ WHAT` recursively grep current directory - `git+ MESSAGE` git: commit and push to master -- `h+` transform line to heading +- `h+` heading - `hg+ MESSAGE` hg: commit and push to master - `lc+` to lowercase -- `nobs+` is taken from plan9 `nobs` (it removes all backspace characters and the characters that precede them) -- `put+ BROWSER` regular `Put` plus reload active tab in browser: `ff` | `ch` | `sa` +- `nobs+` taken from plan9 `nobs` (it removes all backspace characters and the characters that precede them) - `s-` remove leading whitespace - `s2t N_SPACES` spaces to tabs (default: 4 spaces to 1 tab) - `t2s N_SPACES` tabs to spaces (default: 1 tab to 4 spaces) - `t+` add tab - `t-` delete tab - `uc+` to uppercase -- `w+ WIDTH` (hello, `fmt -w WIDTH`) -Put these guys in your **$path**. +Put these guys in your **$PATH**. ## Random notes diff --git a/bin/a+ b/bin/a+ deleted file mode 100755 index acb02f4..0000000 --- a/bin/a+ +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use warnings; -use utf8; -use open qw(:std :utf8); - -my ($d) = @ARGV; -$d = "=>" unless $d; - -my $max = 0; -my @ls = (); -my @rs = (); -my $i = 1; -my $t = ""; - -while () { - if ($i == 1) { - $t = $1 if /^(\s+)/; - $i += 1; - } - $_ =~ s/^\s+|\s+$//g; - my @ls_rs = split $d, $_, 2; - my $len = length $ls_rs[0]; - $max = $len if $len > $max; - push @ls, $ls_rs[0]; - push @rs, $ls_rs[1]; -} - -for (my $i = 0; $i < @ls; $i += 1) { - my $l = $ls[$i]; - my $r = $rs[$i]; - my $n = $max - length $l; - my $s = " " x $n; - $l .= $s; - print $t, $l, $d, $r; - print "\n" unless $i + 1 == @ls; -} diff --git a/bin/cc+ b/bin/cc+ deleted file mode 100755 index a7db02c..0000000 --- a/bin/cc+ +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env perl - -while () { - print join "", map { ucfirst $_ } (split "_", $_); -} diff --git a/bin/cc- b/bin/cc- deleted file mode 100755 index 3b45301..0000000 --- a/bin/cc- +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env perl - -while () { - s/([A-Z]+)([A-Z][a-z])/$1_$2/g; - s/([a-z\d])([A-Z])/$1_$2/g; - print lc; -} diff --git a/bin/d b/bin/d deleted file mode 100755 index d290104..0000000 --- a/bin/d +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env perl - -open FH, "| 9p write acme/$ENV{winid}/addr"; -print FH ","; -system "9p write acme/$ENV{winid}/data 'ff'; -use constant CHROME => 'ch'; -use constant SAFARI => 'sa'; - -my $browser = $ARGV[0] || CHROME; -my $osascript; - -## ACME 'Put' -## ----------------------------------------------------------------------------- - -open my $fh, "| 9p write acme/$ENV{winid}/ctl"; -print $fh "put\n"; -close $fh; - -## FIREFOX SCRIPT (SADLY, IT'S FULL OF BUGS) -## ----------------------------------------------------------------------------- - -if ($browser eq FIREFOX) { - $osascript = 'tell application "Firefox" - activate - delay 2 - tell application "System Events" - keystroke "r" using command down - end tell - end tell'; -} - -## CHROME SCRIPT -## ----------------------------------------------------------------------------- - -if ($browser eq CHROME) { - ## wait for server update - sleep 2; - - $osascript = 'tell application "Google Chrome" to reload active tab of window 1'; -} - -## SAFARI SCRIPT -## ----------------------------------------------------------------------------- - -if ($browser eq SAFARI) { - ## also wait for server update - sleep 2; - - $osascript = 'tell application "Safari" - set docUrl to URL of document 1 - set URL of document 1 to docUrl - end tell'; -} - -## RUN SCRIPT -## ----------------------------------------------------------------------------- - -system "osascript -e '$osascript'"; diff --git a/bin/w+ b/bin/w+ deleted file mode 100755 index dda5833..0000000 --- a/bin/w+ +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use warnings; -use feature 'say'; -use utf8; -use open qw(:std :utf8); - -my $WIDTH_DEFAULT = 80; -my $WIDTH = $ARGV[0] || $WIDTH_DEFAULT; - -sub main { - my $buf = ''; - while (my $line = ) { - if ($line =~ /^\s+$/) { - say $buf; - say '' if ($buf); - $buf = ''; - next; - } - if ($buf) { - $line = $buf . $line; - } - my ($head, $tail) = handle_str($line); - say $head; - $buf = handle_buf($tail); - } - say $buf if $buf; -} - -sub handle_buf { - my $buf = shift; - my $len = length($buf); - if ($len == $WIDTH) { - say $buf; - return ''; - } - if ($len < $WIDTH) { - return $buf; - } - ## $len > $WIDTH - my ($head, $tail) = handle_str($buf); - say $head; - handle_buf($tail); -} - -sub handle_str { - my $str = shift; - if ($str =~ m/^(.{0,$WIDTH})\s(.*)$/) { - return ($1, $2); - } - ## no spaces here: 0..$WIDTH - if ($str =~ m/^(\S*)\s(.*)$/) { - return ($1, $2); - } - ## no whitespace at all - if ($str =~ m/^(\S+)$/) { - return ($1, ''); - } - die "ooops!"; -} - -main();