Skip to content

Instantly share code, notes, and snippets.

View subhajeet2107's full-sized avatar

Subhajeet Dey subhajeet2107

  • India
View GitHub Profile
@subhajeet2107
subhajeet2107 / Dockerfile
Last active May 25, 2021 17:56
Subdev Docker Image: this is my own docker image for development
#docker build -t subdev .
#docker run -p 8000:8000 -d --name subdev -v $(pwd):/home/ubuntu/main -it subdev
#docker exec -it subdev bash
#docker ps -a
#docker start <container_id>
#ifconfig | grep 'inet 192'| awk '{ print $2}'
FROM ubuntu:18.04
RUN apt-get update
ENV LANG en_IN.utf8
@subhajeet2107
subhajeet2107 / qr_code_extract.py
Created November 1, 2020 17:25
Extracts Multiple QR Codes from One single sheet of image using opencv and magic
import cv2
import numpy as np
input_file = 'test.jpg' #this should be full path to image
image = cv2.imread(input_file)
original = image.copy()
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray, (9,9), 0)
thresh = cv2.threshold(blur, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
Install existing with pagespeed, brotli and other: bash <(wget -O - vtb.cx/nginx-ee || curl -sL vtb.cx/nginx-ee) --full --pagespeed --naxsi
@subhajeet2107
subhajeet2107 / Geo Chart
Created March 20, 2020 07:01
Geo Codes for India Geo Chart
India State Codes for Geo:
var data = google.visualization.arrayToDataTable([
['State Code', 'State', 'Result'],
['IN-AN','Andaman and Nicobar Islands',9],
['IN-AP','Andhra Pradesh',13],
['IN-AR','Arunachal Pradesh',34],
['IN-AS','Assam',13],
['IN-BR','Bihar',34],
['IN-CH','Chandigarh',15],
@subhajeet2107
subhajeet2107 / clickhousedump
Created October 9, 2019 09:15
Dump Databases from clichouse
#!/bin/bash
OUTDIR=.
while read -r db ; do
while read -r table ; do
if [ "$db" == "system" ]; then
echo "skip system db"
continue 2;
@subhajeet2107
subhajeet2107 / mysqlimport.sh
Created July 17, 2019 10:59
Import CSV in mysql faster
mysqlimport --ignore-lines=1 \
--fields-terminated-by=, \
--local -u root \
-p Database \
institute_courses_complete.csv
@subhajeet2107
subhajeet2107 / download_images.py
Created May 4, 2019 14:22
Download images and stores in nested folders
#Download images
from pathlib import Path
import shutil, os, requests
urls = []
for url in urls:
r = requests.get(url, stream=True)
image_path = url.replace('https://www.somedomain.com/images/','')
path = Path('/assets/images/' + image_path)
path.parent.mkdir(parents=True, exist_ok=True)
@subhajeet2107
subhajeet2107 / commands.sh
Created April 7, 2019 07:53
How to connect docker mysql with docker sqlpad or phpmyadmin
mysql -u root -p --protocol=tcp -P 3309 #from this you can connect to docker container from host
docker run --name=testsql -p 3309:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
docker run --name myadmin -d --link testsql:db -p 8080:80 phpmyadmin/phpmyadmin
docker run --name sqlpadman -d --link testsql:db -p 3000:3000 sqlpad/sqlpad
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
@subhajeet2107
subhajeet2107 / rancher.sh
Created October 14, 2018 07:20
Rancher Custom Master
sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:latest