python virtual environment

How to create a Python virtual environment. On Windows $ pip install venv $ python3 -m venv ~/python-test On Ubuntu $ sudo apt install python3.8-venv $ python3 -m venv ~/python-test On Mac OS $ brew install virtualenv $ virtualenv python-test Activate $ cd ~/python-test $ source bin/activate Deactivate $ deactivate

February 27, 2022 · 1 min · ulysses

gcp monitor service account

You can monitor the success or failure of a service account in GCP. gcloud policy-intelligence query-activity \ --activity-type=ACTIVITY_TYPE \ --project=PROJECT_ID \ --limit=LIMIT The two options you can use for ACTIVITY_TYPE are: serviceAccountKeyLastAuthentication serviceAccountLastAuthentication

February 24, 2022 · 1 min · ulysses

aws sdk load config

Occasionally I was getting this random error when running Terraform. ╷ │ Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found. │ │ Please see https://registry.terraform.io/providers/hashicorp/aws │ for more information about providing credentials. │ │ Error: RequestError: send request failed │ caused by: Post "https://sts.amazonaws.com/": read tcp xx.xx.xx.xx:59422->xx.xx.xx.xx:443: read: connection reset by peer │ │ │ with provider["registry.terraform.io/hashicorp/aws"], │ on main.tf line 10, in provider "aws": │ 10: provider "aws" { Here’s the fix. Place this in your ~/.bash_profile. ...

February 14, 2022 · 1 min · ulysses

gcp windows password reset

Instead of the GCP Console, you can reset Windows Server password via gcloud. gcloud compute reset-windows-password server-name \ --zone us-central1-a \ --project project-id Username and password will generated.

February 14, 2022 · 1 min · ulysses

google sdk ssh mac terminal

I’m having trouble logging in using Google SDK Compute SSH on a Mac Terminal. Here’s the fix. gcloud compute ssh USERNAME@SERVER --zone ZONE --project PROJECTID --internal-ip 2>&1 There was an issue with a redirect to another shell.

February 14, 2022 · 1 min · ulysses

saml2aws

Use Saml2Aws CLI as an alternative to SAML to AWS STS Key Conversion. Install on Mac. brew install saml2aws saml2aws --version Configure. Provide information. saml2aws configure It will create a ~/.saml2aws config file. Set session to 8 hours. aws_session_duration = 28800 Login. saml2aws login After authentication and/or MFA, your ~/.aws/credentials will be updated.

February 14, 2022 · 1 min · ulysses

gcp compute startup script

How to add startup and shutdown scripts on GCP Compute Engine. Startup Script gcloud compute instances add-metadata servername \ --project project-id \ --zone us-central1-c \ --metadata=startup-script='#! /bin/bash sudo -i echo "Time: $(date)" >> /tmp/date.txt' Shutdown Script gcloud compute instances add-metadata servername \ --project project-id \ --zone us-central1-c \ --metadata=shutdown-script='#! /bin/bash # Shuts down Apache server /etc/init.d/apache2 stop'

February 12, 2022 · 1 min · ulysses

git reset hard

Reset uncommitted changes to both files and directories. git reset --hard Remove untracked files and directories. git clean -fd

February 12, 2022 · 1 min · ulysses

linux prompt display current directory only

Here’s the command to display only the current directory. export PROMPT_DIRTRIM=1 Place the command in your ~/.bashrc to make it permanent.

February 11, 2022 · 1 min · ulysses

set terminal browser to firefox

Every time I log in to Google Cloud, it’s using the Chromium. Set BROWSER env to Firefox instead. export BROWSER=/usr/bin/firefox Login to GCP. It should open up Firefox browser instead of Chromium. gcloud auth login Add it your .bashrc or .bashprofile if you want it to be permanent.

February 7, 2022 · 1 min · ulysses