Skip to content

Instantly share code, notes, and snippets.

@gkranasinghe
gkranasinghe / .gitlab-ci.yml
Created November 14, 2022 11:37
gitlab build and test docker image
stages:
- build
- package
- test
variables:
APP_VERSION: $CI_PIPELINE_IID
build website:
image: node:16-alpine
@gkranasinghe
gkranasinghe / .gitlab-ci.yml
Last active November 14, 2022 10:32
gitlab ci cd file to deploy to AWS
stages:
- build
- test
- deploy staging
- deploy production
variables:
APP_VERSION: $CI_PIPELINE_IID
vscode tests to be discoverable add __init__.py in tests folders
correct approach to run pytest ; here tests is the folder name
python -m pytest tests
to run pytest in venv install pytest in venv and Chai
@gkranasinghe
gkranasinghe / remove-docker-containers-and-untaged-images.md
Last active October 26, 2022 14:57 — forked from JPvRiel/remove-docker-containers-and-untaged-images.md
How to remove unused docker containers and images (cleanup)

Prune /var/lib/docker/overlay

sudo docker system prune -a -f

sudo docker rm -v $(sudo docker ps -a -q -f status=exited)
sudo docker rmi -f  $(sudo docker images -f "dangling=true" -q)
docker volume ls -qf dangling=true | xargs -r docker volume rm

@gkranasinghe
gkranasinghe / remove-docker-containers-and-untaged-images.md
Created October 26, 2022 14:14 — forked from JPvRiel/remove-docker-containers-and-untaged-images.md
How to remove unused docker containers and images (cleanup)

Delete all containers

$ docker ps -q -a | xargs docker rm
  • -q prints only the container IDs
  • -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

@gkranasinghe
gkranasinghe / echo.md
Last active September 16, 2022 04:07
linux echo command short notes

echo command

echo "gayan ranasinghe"
gayan ranasinghe
echo -e "gayan \nranasinghe"
gayan
@gkranasinghe
gkranasinghe / bash_strict_mode.md
Created September 15, 2022 10:33 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@gkranasinghe
gkranasinghe / Python.md
Last active September 15, 2022 09:27
Python using env variables

Install dotenv

conda install -c conda-forge python-dotenv

.env file

TYPE=prod
PORT=5000
Sample Python code (test.py):
@gkranasinghe
gkranasinghe / gcp.txt
Created September 15, 2022 08:49
GCP
Your credentials are stored at ~/.config/gcloud
@gkranasinghe
gkranasinghe / conda.txt
Created September 13, 2022 04:47
Anaconda
#Crate conda environment
conda create --name py35 python=3.5
#Install package
conda install jupyter
pip3 install -r requirements.txt
#auto generate requirements file
pipreqs .