Skip to content

Instantly share code, notes, and snippets.

View guptarohit's full-sized avatar
🧘‍♂️
Focusing 🔁 1.01³⁶⁵

Rohit Gupta guptarohit

🧘‍♂️
Focusing 🔁 1.01³⁶⁵
View GitHub Profile
@guptarohit
guptarohit / sudoku_checker.cpp
Last active November 3, 2016 06:18
Program to check the numbers possible at a position of a Sudoku.
//This program checks the numbers possible at a position of a Sudoku.
//@author : Rohit Gupta
#include <iostream>
using namespace std;
int main() {
int i, j, p, q, ch = 1, freq[10] = {0};
int s[9][9] = {
{0, 0, 0, 0, 0, 0, 6, 8, 0},

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:

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
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`.
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;
}
location / {
...
access_log /var/log/nginx/fast_api.log combined buffer=256k flush=10s;
error_log /var/log/nginx/fast_api.err.log;
}
@guptarohit
guptarohit / pyproject.toml
Created November 14, 2019 11:00
pre-commit hooks configuration
[tool.black]
line-length = 88
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
@guptarohit
guptarohit / .flake8
Created November 15, 2019 12:50
flake8 hook configurations
[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 November 15, 2019 12:49
black hook configuration
[tool.black]
line-length = 88
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
@guptarohit
guptarohit / .isort.cfg
Created November 15, 2019 12:47
isort hook configuration
[settings]
line_length = 88
multi_line_output = 3
include_trailing_comma = True
known_third_party = celery,django,environ,pyquery,pytz,redis,requests,rest_framework