Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Rohit Gupta guptarohit

🎯
Focusing
View GitHub Profile
@guptarohit
guptarohit / .flake8
Created Nov 15, 2019
flake8 hook configurations
View .flake8
[flake8]
max-line-length = 88
max-complexity = 18
select = B,C,E,F,W,T4,B9
ignore = E203, E266, E501, W503, F403, F401
@guptarohit
guptarohit / pyproject.toml
Created Nov 15, 2019
black hook configuration
View pyproject.toml
[tool.black]
line-length = 88
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
@guptarohit
guptarohit / .isort.cfg
Created Nov 15, 2019
isort hook configuration
View .isort.cfg
[settings]
line_length = 88
multi_line_output = 3
include_trailing_comma = True
known_third_party = celery,django,environ,pyquery,pytz,redis,requests,rest_framework
@guptarohit
guptarohit / .pre-commit-config.yaml
Created Nov 14, 2019
pre-commit hooks pipeline with isort, black and flake8
View .pre-commit-config.yaml
repos:
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.3
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
- repo: https://github.com/ambv/black
@guptarohit
guptarohit / pyproject.toml
Created Nov 14, 2019
pre-commit hooks configuration
View pyproject.toml
[tool.black]
line-length = 88
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
View nginx_app_buffered_loggging.conf
location / {
...
access_log /var/log/nginx/fast_api.log combined buffer=256k flush=10s;
error_log /var/log/nginx/fast_api.err.log;
}
View nginx_app_cache.conf
proxy_cache_path /data/nginx/cache keys_zone=my_zone:10m inactive=1d;
server {
...
location /api-endpoint/ {
proxy_cache my_zone;
proxy_cache_key "$host$request_uri$http_authorization";
proxy_cache_valid 404, 302 1m;
proxy_cache_valid 200 1d;
add_header X-Cache-Status $upstream_cache_status;
}
View nginx.conf
worker_processes auto;
#or should be equal to the CPU core, you can use `grep processor /proc/cpuinfo | wc -l` to find; auto does it implicitly.
worker_connections 1024;
# default is 768; find optimum value for your server by `ulimit -n`
access_log off;
# to boost I/O on HDD we can disable access logs
# this prevent nginx from logging every action in a log file named `access.log`.
View raw.sh
Running 20s test @ http://api.endpoint/resource
20 threads and 200 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 192.48ms 274.78ms 1.97s 87.18%
Req/Sec 85.57 29.20 202.00 72.83%
33329 requests in 20.03s, 29.59MB read
Socket errors: connect 0, read 0, write 0, timeout 85
Requests/sec: 1663.71
Transfer/sec: 1.48MB
View keybase.md

Keybase proof

I hereby claim:

  • I am guptarohit on github.
  • I am rohitgupta (https://keybase.io/rohitgupta) on keybase.
  • I have a public key whose fingerprint is 775C D642 C6E6 9C60 1E77 1478 5B33 355F 6D7D F8D6

To claim this, I am signing this object:

You can’t perform that action at this time.