This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install existing with pagespeed, brotli and other: bash <(wget -O - vtb.cx/nginx-ee || curl -sL vtb.cx/nginx-ee) --full --pagespeed --naxsi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OUTDIR=. | |
while read -r db ; do | |
while read -r table ; do | |
if [ "$db" == "system" ]; then | |
echo "skip system db" | |
continue 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqlimport --ignore-lines=1 \ | |
--fields-terminated-by=, \ | |
--local -u root \ | |
-p Database \ | |
institute_courses_complete.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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. | |
""" | |
# --------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:latest |
NewerOlder