Skip to content

Instantly share code, notes, and snippets.

View ranjanashish's full-sized avatar

Ashish Ranjan ranjanashish

  • IIT Madras
  • Chennai, India
View GitHub Profile
@ranjanashish
ranjanashish / log_config.py
Created June 2, 2018 03:10
log_config.py
import logging
def setup_logging(level: str) -> None:
assert level in ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'), f"Invalid log level: '{level}'"
logging.basicConfig(
level=getattr(logging, level),
format='%(asctime)s %(name)-30s %(lineno)5d %(levelname)-8s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
stream=sys.stdout,
@ranjanashish
ranjanashish / .pre-commit-config.yaml
Last active June 23, 2018 16:47
pre-commit configuration for python projects
repos:
- repo: https://github.com/ambv/black
rev: 18.6b2
hooks:
- id: black
args: [--skip-string-normalization]
language_version: python3.6
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
hooks:
@ranjanashish
ranjanashish / .dockerignore
Created June 2, 2018 03:23
docker configuration for python projects
# git
.git/
.gitignore
# python
htmlcov/
.tox/
.coverage
# vim
@ranjanashish
ranjanashish / uwsgi.ini
Created June 2, 2018 03:30
uwsgi configuration for python projects
[uwsgi]
socket = %d/uwsgi.sock
chmod-socket = 666
chdir = %d/..
wsgi-file = wsgi_gevent.py
callable = app
gevent = 500
master = true
workers = 1
stats = 0.0.0.0:5001
@ranjanashish
ranjanashish / nginx.conf
Created June 2, 2018 03:32
nginx configuration for python projects
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@ranjanashish
ranjanashish / tox.ini
Created June 2, 2018 03:35
tox configuration for python projects
[tox]
envlist = py36
skipsdist = True
[testenv]
deps = -rrequirements/dev.txt
commands = pytest --full-trace -x --cov-report term --cov-report html --cov={{ project_name }}
[flake8]
exclude = tests/*

Windows

WinGet

winget install --source winget --exact --id 7zip.7zip
winget install --source winget --exact --id Amazon.AWSCLI
winget install --source winget --exact --id Docker.DockerDesktop
winget install --source winget --exact --id EclipseAdoptium.Temurin.21.JDK
winget install --source winget --exact --id EpicGames.EpicGamesLauncher

Vim

Install linters and fixers

shfmt

@ranjanashish
ranjanashish / k8s-jprofiler-attach.sh
Created March 18, 2020 02:29 — forked from smola/k8s-jprofiler-attach.sh
Attach JProfiler agent to a JVM running in a Kubernetes pod
#!/bin/bash
set -e
if [[ -z ${K8S_JVM_POD} ]]; then
echo "K8S_JVM_POD not defined"
exit 1
fi
EXEC="kubectl exec ${K8S_JVM_POD}"
CP="kubectl cp ${K8S_JVM_POD}"