Skip to content

Instantly share code, notes, and snippets.

from __future__ import division
from PIL import Image, ImageDraw
import math
import os
import re
import time
import zipfile
import tempfile
import glob
@albcunha
albcunha / OCR_IMAGE.PY
Last active November 2, 2018 18:48
OCRs image and adds its content to EXIF field called 'description'
# this script needs an extra file called formula_exif!
# It will ocr an image and save it will save its text content on the EXIF DATA
# this script is used on jupyter notebooks, that´s why the multiprocessing logic need to be on a different file.
# author: Alberto Cartaxo
# 11/01/2018
import glob
import multiprocessing
from tqdm import tqdm
import formula_exif # where the magic happens
@albcunha
albcunha / systray.py
Created October 26, 2018 13:35
Python Script to allow horizontal mouse wrapping on three monitors (it goes from the monitor 1 to monitor 3 and from monitor 3 to monitor 1 if you reach the outer edge
from infi.systray import SysTrayIcon
from win32api import GetCursorPos, SetCursorPos
import time
import multiprocessing
import base64
import tempfile
# I cant pass a IO Binary, so the solution was to create a tempfile for the icon so I only need one py.file
icon = base64.decodebytes(b'''AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCw
AAAAAAAAAAAAAAAAAAAAAAAGlhZceuqq3/
@albcunha
albcunha / Rename_libre_office.py
Last active February 7, 2017 20:42
Macro script to rename file on libre office. You should put this file on "C:\Program Files (x86)\LibreOffice 5\share\Scripts\python" and insert it as macro on toolbar.
import os
from os.path import join, realpath
import zipfile
from shutil import copyfile
import uno
from com.sun.star.beans import PropertyValue
from com.sun.star.awt.PosSize import POSSIZE
def addAwtModel(oDM,srv,sName,dProps):
oCM = oDM.createInstance("com.sun.star.awt.UnoControl"+ srv +"Model")
@albcunha
albcunha / android_ip_cam.py
Created February 5, 2017 22:40
This code takes photo form android app ip_cam from two camera. It was used to with a Samsung S5 and S7 as bookscanner. It worked perfectally. In addition, You can see the video stream from VLC through the "ip + /video'.
import requests
import grequests
import os
import time
import shutil
import os.path
from PIL import Image