You can jump to a line in vi with <line number>G
To jump to a column on the current line, use <column number>| (pipe character)
A place for John to record his techy notes, both to refer back to when needed, and as a help for others...
You can jump to a line in vi with <line number>G
To jump to a column on the current line, use <column number>| (pipe character)
This little script is to append a line to a file after a text match, using ex.
This particular one is for /usr/local/etc/sudoers to add a 5 minute timeout to the root sudo.
#!/bin/bash
FILE=$1
cp -p $FILE $FILE.old
ex $FILE <<EOT
/^User_Alias.*UNIX.*wheel
a
Defaults:UNIX timestamp_timeout=5
.
x!
EOT
#!/usr/bin/perl
#
#
#
use warnings;
use strict;
my $len = 15;
my $plaintext = shift;
if ( ! $plaintext ) {
my @chars;
for my $char (33 .. 126) {
push @chars, chr($char);
}
for (1..$len) {
$plaintext .= $chars[int(rand($#chars))];
}
}
my @schars = ('a'..'z','A'..'Z',0..9,'.','/');
my $salt = '';
for (1..8) {
$salt .= $schars[int(rand($#schars))];
}
my $crypted_pass = crypt($plaintext,'$1$' . $salt )
or die($!);
print "$plaintext\n$crypted_pass\n";
$ dpkg -S /usr/bin/openssl
openssl: /usr/bin/openssl
$ dpkg -S /usr/bin/mkpasswd
whois: /usr/bin/mkpasswd
$ dpkg -S /usr/bin/makepasswd
makepasswd: /usr/bin/makepasswd
$ openssl passwd -1 -stdin <<EOT
passwd
EOT
$1$nRGcgK4T$uI7mxwMxGUt6NQ.lyu42./
$ mkpasswd -5 -s <<EOT
> passwd
> EOT
$1$0rg1g/e9$rh1lfYHX9qkSVihZ9vBcd/
$ makepasswd --crypt-md5 --clearfrom=-
passwd
passwd $1$IEK./reC$UbqosXZvVn6Hv/2Zej.va/
#!/usr/bin/perl -w
#
#
#
use strict;
use Getopt::Std;
our $opt_v;
getopts('v');
sub VERBOSE { $opt_v; }
$ ./try.pl
Use of reserved word "our" is deprecated at ./try.pl line 8.
Global symbol "$opt_v" requires explicit package name at ./try.pl line 8.
Execution of ./try.pl aborted due to compilation errors.
#!/usr/bin/perl -w
#
#
#
use strict;
use Getopt::Std;
use vars '$opt_v';
getopts('v');
sub VERBOSE { $opt_v; }
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pl\OpenWithList]
"g"="THEGUN.EXE"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithList]
"g"="THEGUN.EXE"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]
"C:\\Program Files\\TheGun\\THEGUN.EXE"="TheGun"
"C:\\Progra~1\\TheGun\\THEGUN.EXE"="TheGun"
[HKEY_CURRENT_USER\Software\Classes\Applications\THEGUN.EXE\shell\open\command]
@="C:\\Progra~1\\TheGun\\THEGUN.EXE %1"
[HKEY_CURRENT_USER_Classes\Applications\THEGUN.EXE\shell\open\command]
@="C:\\Progra~1\\TheGun\\THEGUN.EXE %1"
rpm -qa (list all packages installed
rpm -qf /path/to/file (which package provides this file)
rpm -ql (list the files in a package)
# vi /var/yp/etc/auto_home
# cd /var/yp
# make auto.home
# automount -v
-Duser.timezone=Europe/London