Skip to content

Instantly share code, notes, and snippets.

@Dante383
Dante383 / lamr_checksum.py
Created October 9, 2021 16:42
calculate księga wieczysta checksum
chars_translate = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, 'X': 10 ,'A': 11, 'B': 12, 'C': 13, 'D': 14, 'E': 15, 'F': 16, 'G': 17, 'H': 18, 'I': 19, 'J': 20, 'K': 21, 'L': 22, 'M': 23, 'N': 24, 'O': 25, 'P': 26, 'R': 27, 'S': 28, 'T': 29, 'U': 30, 'W': 31, 'Y': 32, 'Z': 33}
weights = [1, 3, 7, 1, 3, 7, 1, 3, 7, 1, 3, 7]
def calculate_checksum (number):
numbers_sum = 0
for idx, val in enumerate(weights):
numbers_sum += chars_translate[number[idx]]*val
@Dante383
Dante383 / get_streets.sh
Created July 17, 2019 04:34
OSM: get all street names with coordinates
#!/bin/bash
if [[ $# -eq 0 || $# -eq 1 ]] ; then
echo 'Usage: ./get_streets.sh input_file.osm output_file.csv'
exit 0
fi
# convert .osm to .o5m
osmconvert $1 -o=temp.o5m
@Dante383
Dante383 / mysqlkiller.sh
Created March 18, 2018 21:59
Remove MySQL completly
#!/bin/sh
sudo -i
service mysql stop
killall -KILL mysql mysqld_safe mysqld
apt-get --yes purge mysql-server mysql-client
apt-get --yes autoremove --purge
apt-get autoclean
deluser --remove-home mysql
delgroup mysql