pdf file does not open in a new tab, It keeps downloading.

I had recently encountered an issue with a pdf that keeps downloading. We wanted the pdf to open in a new tab. This is a href link to a flask endpoint. Clicking on the link keeps make a call to an api and we get a pdf file as response. \ The pdf file doesContinue reading “pdf file does not open in a new tab, It keeps downloading.”

How to access dictionary elements using dot notation in python?

This is how we define a dictionary in python: dict1={‘name’:’raj’, ‘age’:99 } to access the elements of the dictionary, we do this: dict1[‘name’] and dict1[‘age’] What if we want to access the elements of the dictionary like this: dict1.name This will fail. We can easily fix this by creating a pointdict class .. like so:Continue reading “How to access dictionary elements using dot notation in python?”

Powershell script to prevent Windows Screen lock

I have used this simple powershell script to prevent Windows Screen lock. param($minutes = 300)write “….Screen will be awake for …$minutes”$myshell = New-Object -com “WScript.Shell”for ($i = 0; $i -lt $minutes; $i++) {Write-Output “….screen will be awake for ” ($minutes-$i)Start-Sleep -Seconds 60$myshell.sendkeys(“{F15}”)}

Screen Recording in Ubuntu 20.04

Gnome desktop that gets installed with Ubuntu 20.04 comes with a screen recording feature. CTRL + ALT + SHIFT + R will start the screen recording. The recording will be done only for 20 seconds. We want to change this so it records till be stop recording. How to change this? run this command: gsettingsContinue reading “Screen Recording in Ubuntu 20.04”

Shutdown and Startup scripts

I want my cloud instances to shutdown at a particular time. How to do that?Simple, edit the file sudo vi /etc/crontab and add a line This will shutdown your server everyday at 16 PM server time. I need to run a few processes at startup. How to do that? Login as root using the commandssuorContinue reading “Shutdown and Startup scripts”

OWASP ZAP Security Scanning

We installed docker on ubuntu 18.04 ubuntu instance. Install a zap docker image:docker pull owasp/zap2docker-stable Run the owasp zap image as a daemon: docker run -d -u zap -p 8080:8080 -p 8090:8090 -i owasp/zap2docker-stable zap-webswing.sh Remember to open the ports 8080 and 8090 in your server. Once the ports are open, you may access theContinue reading “OWASP ZAP Security Scanning”

Docker installation on ubuntu 18.04 aws instance

Steps to install Docker in ubuntu 18.04 ( or any version of Ubuntu) sudo apt updatesudo apt install apt-transport-https ca-certificates curl software-properties-commoncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add – Now, we need install docker. We know our server is ubuntu 18.04. However, we need to know the name of the ubuntu release – like trustyContinue reading “Docker installation on ubuntu 18.04 aws instance”

Connect to Google Cloud Instance ( Unix) using Mobaxterm or putty.

Using puttygen or equivalent feature in mobaxterm ( Tools-> MobaKeyGen ) , generate RSA key, make sure you select the right options. like so: Save the private key to a file in your local machine. Save the public key also in the local machine. Open Google instance, and paste the public key at the rightContinue reading “Connect to Google Cloud Instance ( Unix) using Mobaxterm or putty.”

Design a site like this with WordPress.com
Get started