Author:
erics , May 26th, 2021
mysql - N - B - e 'show variables like "%datadir%";'
-N: No column headers -B: Batch mode – use tabs as field separators https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-output-formats.html Multiple Formats Available: Table Format – use –result-format=table, alias –table Tab Separated Format – use –result-format=tabbed, alias –tabbed Vertical Format – use –result-format=vertical, alias –vertical JSON Format Output – use –result-format=VALUE, alias –json[=pretty|raw|off] VALUE may be one of: json or […]
Categories: How-To's , Technology Tags: --tabbed , cli , Format , mysql , output , Plain , Table , Vertical
| No comments
Author:
erics , July 1st, 2019
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
DATE = ` date `
(
echo "From: Your Full Name <you@yourdomain.com>"
echo "To: you@yourdomain.com"
echo "Subject: AWS Instances Report for All Customers as of $DATE"
cat << EOT
MIME - Version : 1.0
Content - Type : text / html
Content - Disposition : inline
< html >
< body >
< pre style = "font: monospace" >
EOT
for profile in customer1 customer2 customer3 ; do
for region in ` aws ec2 describe - regions -- output text | cut - f3 ` ; do
echo - e "\nListing Instances for profile $profile in region: '$region'..."
aws ec2 describe - instances \
-- filters "Name=instance-state-name,Values=running" \
-- query 'Reservations[*].Instances[*].[InstanceId, PublicIpAddress, LaunchTime, InstanceType, Tags[?Key==`Name`] | [0].Value]| sort_by(@, &@[0][2])' \
-- region $region \
-- profile $profile \
-- output table
done
done
cat << EOT
< / pre >
< / body >
< / html >
EOT
) | / usr / sbin / sendmail - t
Categories: How-To's , Technology Tags: AWS , aws ec2 , Date , EC2 , Email , Font , Format , howto , html , LaunchTime , mail , monospace , monospaced , Multiple , Region , Regions , SendMail , sort , Sort By , time , tips
| No comments
Author:
erics , January 11th, 2019
UPDATE 07-March-2025 Please visit: How To Prettify Using Vim and Prettier In the normal vim mode, typing gg=G will reindent the entire file. == will re-indent just the current line. http://vim.wikia.com/wiki/Fix_indentation
Categories: How-To's , Technology Tags: Auto-indent , Format , howto , Indent , perl , re-indent , Reformat , tips , vi , vim
| No comments
Author:
erics , August 15th, 2015
For a quick visual check to see what the human-readable date is based on a UNIX timestamp integer: php -r ‘print date(“r”,1483228799);’ php -r ‘print strtotime(“1 Jan 2015”) – 1;’
Categories: How-To's , Technology Tags: cli , Command , Command line , convert , Date , Epoch , Format , php , Stamp , strtotime , time , Timestamp
| No comments
Author:
erics , September 23rd, 2012
var num = 10 ;
var result = num . toFixed ( 2 ) ; // result will equal 10.00
var num = 170.2305 ;
var result = num . toFixed ( 3 ) ; // result will equal 170.231
Categories: How-To's , Technology Tags: Decimal , Format , Format Number , howto , javascript , JS , Number , Number Format , Places , Round , Rounding , tips , toFixed
| No comments
Author:
erics , December 1st, 2011
PHP number_format($number, 2, ‘.’, ‘,’); SMARTY {$number|number_format:2:”.”:”,”}
Categories: How-To's , Technology Tags: Format , howto , Number , php , Smarty , tips
| No comments
Author:
erics , October 10th, 2011
my $ number = 123.45 ;
printf ( "%.3f" , $ number ) ;
Outputs: 123.450
Categories: How-To's , Technology Tags: Decimal , Float , Floating , Floating Point , Format , howto , Number , perl , printf , Round , Rounding , sprintf , tips
| No comments
Author:
erics , October 10th, 2011
To round up to the nearest 5:
use Math :: Round qw ( nhimult ) ;
$ roundedUpNumber = nhimult ( 5 , $ originalNumber ) ;
http://search.cpan.org/dist/Math-Round/Round.pm To round up to the nearest 1: Cross-posted from PerlMonks:
sub roundUp {
my $ n = shift ;
return ( $ n == int ( $ n ) ? $ n : int ( $ n + 1 ) ) ;
}
Categories: How-To's , Technology Tags: Format , howto , Number , perl , Round , Rounding , tips
| No comments