Skip to content

Instantly share code, notes, and snippets.

View navenduagarwal's full-sized avatar

Navendu Agarwal navenduagarwal

  • http://www.sparshik.com
  • Bengaluru
View GitHub Profile
@navenduagarwal
navenduagarwal / mutability_test.py
Created January 29, 2019 13:35
Test for python mutability credits- sentdex
x = 1
def test():
x = 2
test()
print(x)
# Make sure you grab the latest version
curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip
# Unzip
unzip protoc-3.2.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
@navenduagarwal
navenduagarwal / dummyimage.py
Created June 14, 2018 06:09
python script to create dummy image via opencv
import cv2
import numpy as np
def create_blank(width, height, rgb_color=(0, 0, 0)):
"""Create new image(numpy array) filled with certain color in RGB"""
# Create black blank image
image = np.zeros((height, width, 3), np.uint8)
# Since OpenCV uses BGR, convert the color first
@navenduagarwal
navenduagarwal / pythonImageText.py
Last active June 8, 2018 09:27
To insert multi line text (custom font) in an image using python pillow library
from PIL import ImageFont, ImageDraw, Image
import textwrap
import requests
from io import BytesIO
# # load image from file
# image = Image.open("e1.jpg")
# loading image from url
image_from_url = requests.get("https://dummyimage.com/600x1000/000/fff&text=+")