Skip to content

Instantly share code, notes, and snippets.

Echo in bash

"$v" prevents pathname expansion or globbing and field splitting

parameter expansion need to use single quoting '$v' or escaping $v

single quotes prevent shell expansion

Less

+F follow

+N line num

less the last file in a directory

aws-vault usage (duplicate)

can open browser from wsl

google-chrome

lijnux version

requires x-windows

Pylint

fix unresolved import

for custom modules

141

In your workspace settings, you can set your Python path like this:

AWS CloudTrail

need S3 access logging to find access denied errors

use jq and aws cli

( echo "Time,Identity ARN,Event ID,Service,Action,Error,Message";

aws cloudtrail lookup-events --start-time "2019-10-29T06:40:00Z" --end-time "2019-10-29T06:55:00Z" --query "Events[*].CloudTrailEvent" --output text \

AWS S3

List number of items in a bucket

aws-vault exec <role> -- aws s3api list-objects --bucket <bucket_without_s3://> --output json --query "[length(Contents[])]"

AWS Glue

Ran crawler on bucket/folder/

Problem: Created a table for every file in that folder (thousands)

~ $ aws-vault exec <role> -- aws athena list-data-catalogs
{
We couldn’t find that file to show.

VS Code usage

useful tools

String tools

Select text Ctrl Shift P lower, upper, title cases