Month: December 2020

Random Strings and Password Generator

Python 3: secrets module string module secrets module See: 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:

WordPress Backup Scripts Assume wordpress directory set up in /var/www/<domain>/wordpress format Assume wordpress directory is under /home/$USER/<domain> for shared hosting like DreamHost.

Git Cheat Sheet & Visual

git diff –  changes in working directory. git diff –cached – changes in staging area. git diff HEAD – changes in working directory and staging area. Also See

Kernel Coding Style

The following sections from kernel coding style can be applied to almost all programming languages. 6) Functions Functions should be short and sweet, and do just one thing. They shouldfit on one or two screenfuls of text (the ISO/ANSI screen size is 80×24,as we all know), and do one thing and do that well. The …

Kernel Coding Style Read More »

Windows 10: Dev Tools

Windows Subsystem for Linux (WSL) Visual Studio Code with WSL winget – discover, install, upgrade, remove and configure applications on Windows 10 Windows Terminal PowerShell Oh my Posh – theme engine for PowerShell PowerToys See:

Perl: Generate Random Value

Using perl -e Using debugger as REPL with perl -de x (x can be anything) See: Also see

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

Git Commit Message Convention

The reasons for these conventions: automatic generating of the changelog explicit commit history simple navigation through git history easier to write automated tools on top of commit history Commit message format: The commit contains the following structural elements, to communicate intent to the consumers of your library: fix: a commit of the type fix patches a bug in your …

Git Commit Message Convention Read More »

JavaScript: ArrayBuffer and TypedArray

JavaScript typed arrays split the implementation into buffers and views. A buffer (implemented by the ArrayBuffer object) is an object representing a chunk of data; it has no format to speak of and offers no mechanism for accessing its contents. In order to access the memory contained in a buffer, you need to use a view. A view provides a …

JavaScript: ArrayBuffer and TypedArray Read More »

Working with Slack Bot

See: Basic Slack app setup See Your Created Apps to get bot token Initial Setup Get Channel Info A conversation object contains information about a channel-like thing in Slack. It might be a public channel, a private channel, a direct message, or a multi-person direct message. See: Need to add some permission to list …

Working with Slack Bot Read More »

Java: Date Time

Prefer java.time package introduce in Java 8 Prefer java.time.format.DateTimeFormatter than java.text.SimpleDateFormatter Prefer java.time.Instant than java.sql.Timestamp The time since January 1st 1970 in milliseconds System.currentTimeMillis() new Date().getTime() new Timestamp(System.currentTimeMillis()).getTime() Measure Code Execution Duration java.util.TimeZone java.time.format.DateTimeFormatter java.time Package java.time – The main API for dates, times, instants, and durations Clock A clock providing access to the …

Java: Date Time Read More »