Skip to content

Instantly share code, notes, and snippets.

Avatar

soshial

View GitHub Profile
@soshial
soshial / LKS-92.py
Last active Apr 12, 2020
EPSG:3059 (LKS-92) koordināšu pārrēķins uz platuma un garuma grādiem; transform coordinates code
View LKS-92.py
import math
def lks_2_latlon(x, y):
# Ellipsoid model constants (actual values here are for WGS84) */
UTMScaleFactor = 0.9996
sm_a = 6378137.0
sm_b = 6356752.314
x -= 500000.0
# Pirmā atšķirība no WGS84 - Kilometriņš šurpu, kilometriņš turpu.
@soshial
soshial / outline_pdf2djvu.py
Last active Jan 14, 2017
Converting PDF table of contents into DjVu outline
View outline_pdf2djvu.py
import xml.etree.ElementTree
import djvu.decode as djvu
import sys
__author__ = 'soshial'
'''
1. export bookmarks from PDF using pdfminer:
> python tools/dumppdf.py -T ~/book.pdf > ~/toc_pdf.xml
2. use current script to convert bookmarks (we need python-djvulibre), but it could be easily done without it (using pages, see http://www.ub-filosofie.ro/~solcan/wt/gnu/d/bdjv.html)
@soshial
soshial / template.xml
Last active Jun 1, 2018
ABBYY FineReader HotFolder template *.fta file
View template.xml
<?xml version="1.0"?>
<scenarios xmlns="http://www.abbyy.com/FineReader/Shell/TaskAutomation/0">
<scenario name="Моя задача111">
<operation operationType="UseBatch" mode="loadOptions" batchOrOptionsPath="" checkAfterExecute="false"
optionsMode="loadOptions">
<batchOptions xmlns="http://www.abbyy.com/FineReader/BatchOptions/0" hasLanguageDataBase="false">
<ocr options="OCRO_DetectTables,OCRO_DetectPictures" textType="STT_Normal" hilightLevel="SBEHL_Thorough"
patternName="(Default)" patternMode="UPM_DontUseUserPattern">
<language type="" languages="French,RussianOldSpelling"/>
</ocr>
@soshial
soshial / gist:2971507
Created Jun 22, 2012
Restoring Firefox session tabs from sessionstore.bak
View gist:2971507
import json,codecs
session_text = codecs.open( "sessionstore.bak", "r", "utf-8" ).read()
json = json.loads(session_text)
for i in range(len(json['_closedWindows'][0]['tabs'])):
print json['_closedWindows'][0]['tabs'][i]['entries'][-1]['url']
print 'done'
You can’t perform that action at this time.