Skip to content


vim and vimrc file options

vimrc file options

vimrc file options

  • Remember, if you are using a colorscheme, you need to download that scheme. Example, check the link for the happy_hacking

  • If you use this .vimrc suggestion file, it enables vim visual mode, so mouse support is enable on vim.

  • Basic commands in visual mode are :

    • shift+y to copy
    • shift+p to paste
  • Below, suggestion for file .vimrc ...

""" read first from this file
""" from " Website:
"colorscheme happy_hacking
colorscheme yozakura

""" then apply personalisations
filetype off

"highlight clear

filetype plugin indent on " Filetype auto-detection
syntax on " Syntax highlighting

"set background=dark

""" set UTF-8 encoding
set encoding=utf-8
set fenc=utf-8
set termencoding=utf-8
""" disable vi compatibility (emulation of old bugs)
set nocompatible
""" use indentation of previous line
set autoindent
""" use intelligent indentation for C
"set smartindent
""" configure tabwidth and insert spaces instead of tabs
set tabstop=4        " tab width is 4 spaces
set shiftwidth=4     " indent also with 4 spaces
set expandtab        " expand tabs to spaces
""" wrap lines at 120 chars. 80 is somewaht antiquated with nowadays displays.
set textwidth=120
""" turn syntax highlighting on
set t_Co=256
"syntax on
""" colorscheme wombat256
""" turn line numbers on
set number
""" highlight matching braces
set showmatch
""" intelligent comments

set softtabstop=4
set showcmd
set showmatch
set incsearch
set hlsearch

set hidden

"if has('termguicolors')
"    set termguicolors

set mouse=a


" Use case insesitive search
set ignorecase
set smartcase

" Display cursor position
set ruler

" Prompt to save file on exit
set confirm

" Disable beep
set visualbell

" Highlight cursor line
set cursorline


AWS VPC flowlogs CloudWatch logs CloudTrail logs and filters examples

Official Documentations -

Basic sample VPC-flow-logs

[version, account, eni, source, destination, srcport, destport="8000", protocol, packets, bytes, windowstart, windowend, action, flowlogstatus]

VPC flow logs example with combination of AND

[version, account, eni, source="185.2*", destination, (srcport!="80" && srcport!="443"), (destport!="80" && destport!="443"), protocol, packets, bytes, windowstart, windowend, action, flowlogstatus]

Basic Expressions Operators

= -- EQUAL






&& -- AND

|| -- OR

Cloud Trail Logs Filter examples

  • filter by Failure Console Logins 'ConsoleLogin="Failure"'

{ $.eventSource = "" && $.responseElements.ConsoleLogin = "Failure" }

  • exclude know IP address

{ ($.sourceIPAddress != "") && ($.sourceIPAddress != "33.123.123.*") && ($.sourceIPAddress != "*") }

  • AWS login without using MFA

{ $.eventSource="" && $.additionalEventData.MFAUsed="No" }

Happy learning

Antonio Feijao UK


Linux command lsusb

lsusb | grep -i cam

Bus 001 Device 004: ID 046d:0825 Logitech, Inc. Webcam C270
  • Now, use the Bus and Device numbers with -v option for verbose and filter for "Width|Height" and grep command.
$ lsusb -s 001:002 -v | egrep "Width|Height"

    wWidth    640
    wHeight   480
    wWidth    1280
    wHeight   1024

lsusb with sort awk grep uniq

I also like to use command likes sort, awk, grep and uniq.

echo "Maximum --> Width <-- will come on top" && lsusb -s 001:004 -v | grep "Width"  | awk '{print $2 " " $1}' | sort | uniq | sort -nr

echo "Maximum --> Height <-- will come on top" && lsusb -s 001:004 -v | grep "Height"  | awk '{print $2 " " $1}' | sort | uniq | sort -nr


  • or another elegant option if available to you is :

v4l2-ctl --list-formats-ext

some credits go to


Raspberry Pi increase the swap memory size

  • First edit the swap configuration file

Change the size for your preference, Default is 100, (100MB)

Change for example for 2048 (2GB)

sudo vim /etc/dphys-swapfile

  • Second, restart the service

sudo /etc/init.d/dphys-swapfile restart

  • Confirm

Default swap file location is ls -lh /var/swap

-rw------- 1 root root 2.0G Feb 29 20:20 /var/swap

  • HTOP - you can also confirm with htop to see memory, cpu and swap usage.

If you do not have htop installed, you can install it with apt-get install htop


Python 3 learning for the first time

I have a background in shell scripting, so when I had to automate something, bash scripting would do the job just fine!

I also want to learn Python because is widely use nowadays and easy to integrate in most AWS Services, specifically useful for events with Lambda in AWS within serverless architectures.

Took me a while to do something useful with Python 3. At first, seemed an easy language to learn, and I still think it is!

If you already started first steeps, you know you can easily do print a print ("Hello World"), and you probably learnt a difference on the print command. From Python 2 to Python 3, you now have to use the parentheses ( ... )...

Just the command print is not enough to make something useful.

I thought that there might be someone else out there struggling to get started in Python 3, so I decided to share my experience on "How I start learning Python 3 and doing something useful".

You can execute command directly from running the command python3

CommandLine $ > python3
Python 3.7.4 (default, Jul  9 2019, 18:13:23)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print ("Hello World for")
Hello World for
>>> exit()
CommandLine $ >
CommandLine $ >

Then, I installed ipython and practice from there, but I was still on the basics commands and wanted to learn more.

Learn Python 3 on-the-go offline and mobile phone

After trying the basics, I set myself to practice on commute or free time.

Started by downloading the mobile app SoloLearn and started to practices while I was on commute. Some time later I completed the course, and Hey! Actually the final certificate feels like a good and well deserved rewards for completing the corse.

Here is mine [Antonio SoloLearn Python Certificate].

Learning by doing and practice often

So, after that, it really boosted my Python 3 skill when i started the fun project Stranger Things Alphabet Wall Lights.

With a fun challenge and with some physical visual result I felt is a lot more engaging.

commandI set fun challenge, something simple that only requires for loops, while loops and


Feel free to leave a feedback and share your experience.



Stranger Things Alphabet Wall Lights with Raspberry Pi Python 3 and Neopixels

It all started with the launch of Stranger Things Season 3.

We, Kat Decided to invite a couple of friend for the first episode of ST Session 3 and why not create some scary wall that spells out some words?!

Why not, right?

Proof of Concept

What I used:

  • 1x Raspberry PI 3b+ with power supply
  • 1x Pack of 50 addressable RGB LEDs from Amazon - (LINKS)[LINKS]
  • 1x Power supply 5V for the Raspberry PI
  • 1x Power supply 5v for the LEDs
  • 1x breadboard with a couple electric cables



Lists all ec2 instances in all regions including account owner, instance id, instance type, statues and region.

for region in `aws ec2 describe-regions --output text | cut -f4`; do
    echo -e "\nInstances in: '$region':";
    aws ec2 describe-instances --query 'Reservations[*].Instances[*].[NetworkInterfaces[0].OwnerId, Placement.AvailabilityZone, VpcId, InstanceId, InstanceType, State.Name]' --output text --region ${region};


AWS cli IAM roles and tokens

aws sts assume-role --role-arn arn:aws:iam::ACCOUNT-NUMBER:role/ROLE-NAME --role-session-name "RoleSession1" | \
sed 's/[," :]//g;s/AccessKeyId/export AWS_ACCESS_KEY_ID=/;s/SessionToken/export AWS_SECURITY_TOKEN=/;s/SecretAccessKey/export AWS_SECRET_ACCESS_KEY=/' | \
grep 'export' | \

export AWS_ACCESS_KEY_ID=xxxxxxxxxxx
export AWS_SECURITY_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx