gitedit: First release.

This commit is contained in:
Ole Tange 2024-08-17 22:54:26 +02:00
parent 10420e0f99
commit 803cfd6433
5 changed files with 88 additions and 24 deletions

View file

@ -10,7 +10,7 @@ gitdiffdir - git diff, but between two dirs in different repositories
=head1 SYNOPSIS
B<gitdiffdir> [I<diff options>] I<dir1> I<dir2>
B<gitdiffdir> [I<diff options>] I<dir1> [I<dir2>]
=head1 DESCRIPTION
@ -25,6 +25,8 @@ files but on two dirs in different repositories.
B<gitdiffdir> passes options to B<diff>. Default: B<-Naur>
I<dir2> defaults to .
=head1 EXAMPLES
Diff dirs with the same name:
@ -93,7 +95,7 @@ if [ ${#diff_options[@]} -eq 0 ]; then
fi
dirA="${others[0]}"
dirB="${others[1]}"
dirB="${others[1]:-.}"
# Remove all trailing slashes
while [[ "$dirA" == */ ]]; do

72
gitedit/gitedit Executable file
View file

@ -0,0 +1,72 @@
#!/bin/bash
: <<=cut
=pod
=head1 NAME
gitedit - Edit git log
=head1 SYNOPSIS
gitedit [number of commits]
=head1 DESCRIPTION
B<gitedit> edits the last n commits.
It simply runs:
rebase -i HEAD~n
=head1 EXAMPLE
Edit the past 10 commits.
gitedit
Edit the past 50 commits.
gitedit 50
=head1 AUTHOR
Copyright (C) 2024 Ole Tange,
http://ole.tange.dk and Free Software Foundation, Inc.
=head1 LICENSE
Copyright (C) 2012 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
at your option any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
=head1 DEPENDENCIES
B<gitedit> uses B<git>.
=head1 SEE ALSO
B<git>
=cut
n=${1-10}
git rebase -i HEAD~"$n"

View file

@ -35,13 +35,14 @@ B<goodpasswd> generates access codes that:
=head2 Characters considered too close
These character couples are too similar either in different fonts or
in a bad copy and are thus forbidden: B8 cC g9 6G kK lI l1 oO O0 pP sS uU vV xX zZ Z2 ,. :; `' S5
in a bad copy and are thus forbidden:
B8 cC g9 G6 kK lI l1 oO O0 pP sS S5 uU vV xX zZ Z2 ,. :; `'
These characters cause problems in URLs: @/:
These characters cause problems in shell: ! " # $ & ( ) [ ] { } ? | < > \ * =
These characters cause problems in SQL (wildcard): %
These characters cause problems in SQL: % (wildcard) + (login)
These characters are hard to type: ^ ~ ¨ ¤ § ½ æ ø å Æ Ø Å
@ -49,24 +50,25 @@ These characters are hard to type: ^ ~ ¨ ¤ § ½ æ ø å Æ Ø Å
Never use the same chars twice in a row: e.g. -- is bad.
Do not start with '-' or '+' as that looks like an (long) option
Do not start with '-' as that looks like an (long) option
=head1 EXAMPLE
B<goodpasswd> will give output similar to FJiY7j+7DQ-D.
B<goodpasswd> will give output similar to iTtNRf3MYdMb+rNhYniY.
=cut
#
# US-kbd: ~!@#$%^&*()_+ [] {} ;'\ :"| < > ,./ <>?
# DK-kbd: §!"#¤%&/()=?` å" Å^ æø' ÆØ* < > ,.- ;:_
# Common: ! # % < > ,.
my $pw;
my @chars=split //, 'abdefhijmnqrtyADEFHJLMNQRTY347+-';
# 31-1 possibilities = ~4.9 bit entropy
# 20 chars = 98 bit
my @chars=split //, 'abdefhijmnqrtyADEFHJLMNQRTY347-';
do {
$pw = "";
for (1..12) {
for (1..20) {
$pw .= $chars[rand $#chars+1]
}
} while (($pw =~ /^[+-]/ or $pw =~ /(.)\1/) or

View file

@ -66,8 +66,7 @@ B<man>
=cut
dir=/tmp/pdfman-`echo $USER "$@" | md5sum|cut -d ' ' -f 1`
pdf="$dir/$@"
pdf=$(mktemp)
viewer=$PDFVIEWER
if which okular >/dev/null; then
@ -84,8 +83,7 @@ cleanup() {
if [ "$noclean" == 1 ] ; then
true
else
rm $pdf
rmdir $dir
rm "$pdf"
fi
}
@ -105,16 +103,6 @@ pdfviewer() {
trap control_c SIGINT
if [ -d "$dir" ] ; then
# PDF-viewer already running for this $pdf
# Assume it will re-read new file and do the cleanup
noclean=1
noview=1
else
mkdir "$dir"
fi
man -w "$@" |
parallel 'zcat {} || cat {}' 2>/dev/null |
# Convert ˆ to ^

View file

@ -55,7 +55,6 @@ Wait at most I<maxwait> seconds.
=back
=head1 EXAMPLES
(sleep 0.5; echo After 0.5s; sleep 1.5; echo After 2s) |
@ -219,6 +218,7 @@ sub min(@) {
sub readfile {
# Input is in .tt-format
my $file = shift;
my $fh;
if($file eq "-") {
$fh = *STDIN;