Skip to content

Instantly share code, notes, and snippets.

Working from home


Working from home
View GitHub Profile
soshial /
Last active Jul 18, 2021
Freematics + Traccar (integration and configuration)

How does Freematics work? (firmware_v5/telelogger.ino sketch)

  1. Doesn't work at all with no external power. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V).
  2. It has 2 types of requests, the first sends only events and alarms (without location) and the other sends only key-value data payload (location, ODB data, etc.).
  3. Device gathers data every X milliseconds (see the DATA_INTERVAL_TABLE parameter). The data gets immediately written to file storage as CSV files (but flushed incrementally with each 1 KiB, equal to approximately 6 records). Always choose SD card as a storage (#define STORAGE STORAGE_SD), since internal SPIFFS memory is very small and will cyclically rewrite itself.
  4. Freematics goes into standby mode after 180 seconds (the third value of STATIONARY_TIME_TABLE parameter). Wakes up after the accelerator sensor wakes it up. When in standby, Freematics pings the server every PING_BACK_INTERVAL seconds (15 min by default) and if there is no connection,
soshial /
Last active Apr 12, 2020
EPSG:3059 (LKS-92) koordināšu pārrēķins uz platuma un garuma grādiem; transform coordinates code
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 /
Last active Jan 14, 2017
Converting PDF table of contents into DjVu outline
import xml.etree.ElementTree
import djvu.decode as djvu
import sys
__author__ = 'soshial'
1. export bookmarks from PDF using pdfminer:
> python tools/ -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
soshial / template.xml
Last active Jun 1, 2018
ABBYY FineReader HotFolder template *.fta file
View template.xml
<?xml version="1.0"?>
<scenarios xmlns="">
<scenario name="Моя задача111">
<operation operationType="UseBatch" mode="loadOptions" batchOrOptionsPath="" checkAfterExecute="false"
<batchOptions xmlns="" hasLanguageDataBase="false">
<ocr options="OCRO_DetectTables,OCRO_DetectPictures" textType="STT_Normal" hilightLevel="SBEHL_Thorough"
patternName="(Default)" patternMode="UPM_DontUseUserPattern">
<language type="" languages="French,RussianOldSpelling"/>
soshial / gist:2971507
Created Jun 22, 2012
Restoring Firefox session tabs from sessionstore.bak
View gist:2971507
import json,codecs
session_text = "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'