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
""" | |
Command line tool for processing of a batch of PDF files stored on gcloud storage with a Document | |
AI processor. | |
`pip install python-dotenv google-cloud google-cloud-documentai | |
google-cloud-documentai-toolbox google-cloud-storage` | |
Also create a .env file for populating default values, containing following | |
keys: GCP_PROJECT_ID, PROCESSOR_ID, PROCESSOR_LOCATION, GCS_DOCUMENT_BUCKET and | |
GCS_DOCUMENT_TEXT corresponding to an OCR | |
processor created on the Document AI platform of your GCP project. The two last | |
keys correspond to the name of gcloud storage buckets, first for the stored PDF |
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
""" | |
Command line tool to run OCR with a Document AI processor over a single local PDF file | |
`pip install python-dotenv google-cloud google-cloud-documentai` | |
Also create a .env file for populating default values, containing following | |
keys: GCP_PROJECT_ID, PROCESSOR_ID, PROCESSOR_LOCATION corresponding to an OCR | |
processor created on the Document AI platform of your GCP project. | |
""" | |
from google.api_core.client_options import ClientOptions | |
from google.cloud import documentai |
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 | |
sudo apt -y install git python3-pip | |
echo "alias python=python3" >> ~/.bashrc | |
source ~/.bashrc | |
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh | |
bash Miniconda3-latest-Linux-x86_64.sh -b | |
rm Miniconda3-latest-Linux-x86_64.sh | |
miniconda3/bin/conda init bash | |
source miniconda3/etc/profile.d/conda.sh |
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
#include <stdlib.h> | |
#include <string.h> | |
#include <stdbool.h> | |
bool endswith(char* str, char* suffix) { | |
size_t str_length = strlen(str); | |
size_t suffix_length = strlen(suffix); | |
if (str_length < suffix_length) return false; | |
return strncmp(str + str_length - suffix_length, suffix, suffix_length)) == 0; |
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 | |
# shell script for removing all libraries installes | |
# could be useful for building a clean virtual environment on top of it | |
input="requirements.txt" | |
pip freeze > "${input}" | |
while IFS= read -r line; do |
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
set nocompatible " be iMproved, required | |
filetype off " required | |
syntax enable " syntax highlight | |
set t_Co=256 " set 256 colors | |
set number " show line numbers | |
set ruler |
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 | |
max_temperature=0 | |
for d in /sys/class/thermal/thermal_zone* ; do | |
temperature=$(cat ${d}/temp) | |
if [[ $max_temperature -eq 0 || $temperature -gt $max_temperature ]]; then | |
max_temperature="${temperature}"; | |
fi | |
done | |
max_temperature=$(( max_temperature / 1000 )) |
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 setuptools | |
with open('README.md', 'r', encoding='utf-8') as fh: | |
long_description = fh.read() | |
setuptools.setup( | |
name='mypackage', | |
version='0.0.1', | |
author='My Name', | |
author_email='[email protected]', |
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
#!/usr/bin/env bash | |
# Default values | |
OUTPUT_DIR="" | |
PREFIX="" | |
N_IMAGES=0 | |
INTERVAL=3 | |
while [[ ! $# -eq 0 ]]; do # looping through the arguments | |
case "$1" in |
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
from pathlib import Path | |
import sys | |
import os | |
mapping = {'cz': 'czech', | |
'pl': 'poland'} | |
start_dir = sys.argv[1] |