Scripting

screen CheatSheet

~/.screenrc Example screen config file: .screenrc Start a new screen session Start a new screen session with session name List screen sessions Attach a screen session <name> can be the part of the session name (search term) if there is no conflict. If the search term match multiple session names, the attach will fail. Detach …

screen CheatSheet Read More »

Random Strings and Password Generator

Python 3: secrets module string module secrets module See: https://docs.python.org/3/library/secrets.html Random Strings for Bash For macOS, add env LC_ALL=C to avoid error: tr: Illegal byte sequence Example Strong Password with tr and /dev/urandom For macOS, add env LC_ALL=C to avoid error: tr: Illegal byte sequence Also see: https://gist.github.com/earthgecko/3089509

WordPress Backup Scripts

backup-wordpress-dir.sh Assume wordpress directory set up in /var/www/<domain>/wordpress format backup-wordpress-site.sh Assume wordpress directory is under /home/$USER/<domain> for shared hosting like DreamHost. backup-database.sh restore-database.sh

Perl: Generate Random Value

Using perl -e Using debugger as REPL with perl -de x (x can be anything) See: https://perldoc.perl.org/perlfaq3#How-can-I-use-Perl-interactively? Also see http://www.perlmeme.org/howtos/perlfunc/rand_function.html

Perl Programming Language: Intro

Perl Intro Basic syntax overview Perl variable types Variable scoping Conditional and looping constructs Builtin operators and functions Files and I/O Regular expressions Writing subroutines OO Perl and Using Perl modules