Wednesday, June 23, 2021

Using Windows Command Line to make a dummy file

Echo 64 bytes to a seed file: 

C:\Temp>echo This is just a sample line appended to create a bi wefhwef weh> dummy8.txt

Then call 'type' in a for loop to append the contents of the file to itself:

C:\Temp>for /L %i in (1,1,8) do type dummy.txt >> dummy.txt

Makes a  32,768 byte (32Kb) file.

Courtesy https://www.windows-commandline.com/how-to-create-large-dummy-file/


Tuesday, June 8, 2021

Formatting Time and Date with Perl

# timestamp examples
use strict;
use warnings;
use v5.10.0;

use POSIX qq(strftime);

my $timestamp = strftime("%Y-%m-%d_%a_%H-%M-%S",localtime);

say $timestamp; # 2021-06-08_Tue_11-54-28

# ------------------------------------------------------------------------------

use DateTime;

my $today = DateTime->today();

say $today; # 2021-06-08T00:00:00

say $today->date; # 2021-06-08