https://github.com/t1m0n/air-datepicker Docs : http://t1m0n.name/air-datepicker/docs/
include in html template
#Optimally resize `img` according to the bounding boxes specified in `boxes` (which is simply the (pruned) results from `pytesseract.image_to_data()`). | |
#Tesseract performs optimally when capital letters are ~32px tall (https://groups.google.com/g/tesseract-ocr/c/Wdh_JJwnw94/m/24JHDYQbBQAJ). Smaller text obviously can't be OCR'd as accurately, but weirdly enough, larger text causes problems as well. So, this function uses the bounding boxes we've found and resizes the image so that the median line height should be ~32px. | |
def optimal_resize(img, boxes): | |
median_height = np.median(boxes["height"]) | |
target_height = 32 #See https://groups.google.com/g/tesseract-ocr/c/Wdh_JJwnw94/m/24JHDYQbBQAJ | |
scale_factor = target_height / median_height | |
print("Scale factor: " + str(scale_factor)) | |
#If the image is already within `skip_percentage` percent of the target size, just return the original image (it's better to skip resizing if we can) | |
skip_percentage = 0.07 |
"""Convert office document to file formats that may be visible in a web browser. This file uses microsoft office to | |
convert the files, so Windows OS is assumed and required! | |
Requirements: | |
* pywin32>=228 # Not available for Python3.8 at this time | |
Server Requirements: | |
* uvicorn>=0.11.5 | |
* fastapi>=0.58.0 | |
* python-multipart>=0.0.5 |
https://github.com/t1m0n/air-datepicker Docs : http://t1m0n.name/air-datepicker/docs/
include in html template
from subprocess import Popen,PIPE, check_output | |
import os, sys | |
import tempfile | |
import uuid | |
import cv2 | |
import pytesseract as pt | |
from PIL import Image | |
def convert_dpi(input_image): | |
path = tempfile.gettempdir() |
static String formatBytes(int bytes, int decimals) { | |
if (bytes <= 0) return "0 B"; | |
const suffixes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; | |
var i = (log(bytes) / log(1024)).floor(); | |
return ((bytes / pow(1024, i)).toStringAsFixed(decimals)) + | |
' ' + | |
suffixes[i]; | |
} |
from bs4 import BeautifulSoup | |
from markdown import markdown | |
import re | |
def markdown_to_text(markdown_string): | |
""" Converts a markdown string to plaintext """ | |
# md -> html -> text since BeautifulSoup can extract text cleanly | |
html = markdown(markdown_string) |
''' | |
Run the following commands (bc. gists don't allow directories) | |
pip install flask django dj-database-url psycopg2 | |
mkdir -p app/migrations | |
touch app/__init__.py app/migrations/__init__.py | |
mv models.py app/ | |
python manage.py makemigrations | |
python manage.py migrate |
After a weekend of research, stress and pain I finally figure out how to install manjaro 17 and configure the nvidia/bumblebee drivers on my avell laptop
Here's my notebook specs:
$ inxi -MGCNA
Machine: Device: laptop System: Avell High Performance product: 1513
Mobo: N/A model: N/A v: 0.1 UEFI: American Megatrends v: N.1.02 date: 09/28/2016
Battery BAT0: charge: 44.0 Wh 100.0% condition: 44.0/44.0 Wh (100%)
// https://raw.githubusercontent.com/donnut/typescript-ramda/master/ramda.d.ts | |
// https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/master/lodash/lodash.d.ts | |
declare namespace fp { | |
interface Dictionary<T> { | |
[index: string]: T; | |
} | |
interface CurriedFunction1<T1, R> { |
// Demo at http://codepen.io/jondaiello/full/YWRbOx/ | |
/* This mixin is for generating CSS arrows on a box */ | |
@mixin box-arrow($arrowDirection, $arrowColor, $arrowSize: 10px) { | |
position: relative; | |
z-index: 10; | |
&::after { | |
content: ''; | |
width: 0; | |
height: 0; |