Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3.9
# -*- coding: utf-8 -*-
import pandas
names = ["a", "a_ifopt", "b", "b_ifopt", "count"]
vorher = pandas.read_csv("dep_stats_vorher.csv", header=None, names=names, sep=";", encoding="utf-8", dtype=str)
nachher = pandas.read_csv("dep_stats_nachher.csv", header=None, names=names, sep=";", encoding="utf-8", dtype=str)
@d3d9
d3d9 / ちきゅう大爆発-en.txt
Last active December 20, 2021 12:58
ちきゅう大爆発/P丸様。- EN translation
Original video: https://www.youtube.com/watch?v=8fpky0u3vVc (My original comment disappeared, new comment held for review, probably never to be published since they don't care)
Translation as YouTube subtitles: https://youtu.be/B8Bm4N_19gY
LN (older revision & modified by others): https://www.lyrical-nonsense.com/global/lyrics/pmaru-sama/chikyuu-daibakuhatsu/
LT: https://lyricstranslate.com/en/tikiyuuda-bao-fa-planet-big-bang.html
Giddy-up supper sloppily, bye bye, boiling point of 10℃
You can talk about PDCA, but it’s unsophisticated when going to the Savannah
It feels like the world is carelessly falling ill, applying downfall lightly is a no-no ♡
But before that, the “I love you” to my crush…
@d3d9
d3d9 / efa.py
Last active June 2, 2021 14:27
Code, der jahrelang für https://twitter.com/hstbot lief, zur Ausführung per crontab. Verwendet python-twitter 3.3.1. WTFPL
import requests
import twitter
#import sys
from datetime import datetime
import logging
import xml.etree.ElementTree as ET
logging.basicConfig(filename='efa.log',level=logging.INFO)
tweet_length = 280
hashtags = "#VRR"
@d3d9
d3d9 / hagen.ini
Last active November 8, 2020 22:46
Hausnummernvergleich zwischen amtlichen Daten der Stadt Hagen und Daten von OpenStreetMap.
[Sources]
AmtUrl = http://www.stadtplan.hagen.de/StrVz/Hauskoordinaten.csv
AmtSep = ;
AmtEnc = cp1252
AmtCRS = EPSG:4647
OsmUrl = http://overpass-api.de/api/interpreter?data=%5Bout%3Acsv%28%3A%3Alat%2C%3A%3Alon%2C%3A%3Aid%2C%3A%3Atype%2C%22addr%3Apostcode%22%2C%22addr%3Astreet%22%2C%22addr%3Ahousenumber%22%2C%22addr%3Aplace%22%3Btrue%3B%22%3B%22%29%5D%5Btimeout%3A200%5D%3B%0Aarea%283601800297%29-%3E.searchArea%3B%0A%28%0A%20%20node%5B%22addr%3Ahousenumber%22%5D%28area.searchArea%29%3B%0A%20%20way%5B%22addr%3Ahousenumber%22%5D%28area.searchArea%29%3B%0A%29%3B%0Aout%20center%3B
;OsmPlace = Hagen
OsmSep = ;
OsmEnc = utf-8
# -*- coding: utf-8 -*-
from dataclasses import dataclass, field
from datetime import datetime, timezone
from enum import Enum
from requests import get
from typing import Set, List, Dict, Callable, Union, Optional, Any, Tuple, Iterable
import xml.etree.ElementTree as ET
@dataclass
Angaben original von http://wahlergebnisse.stadt-hagen.de/prod/KW2020/05914000/html5/OpenDataInfo.html
Parteifarben aktuell nicht mehr einfach auffindbar.
Datei ob-name.json basiert nicht auf der o. g. Seite.
Datei: trip_vdt.din
Ausgangslage:
-> Dokumentation von Mentz ist (sowieso) nicht anwendbar
-> Primaerschlussel enthaelt angeblich NICHT die TRIP_ID, diese ist aber trotzdem als mandatory angegeben, und in der description steht wiederum etwas mit "nur"
-> Habe mich dazu entschieden, STR_LINE_VAR und LINE_DIR_NR nicht im PK aufzunehmen, dafuer aber TRIP_ID, die sowieso immer vorkommt.
-> LINE_NR und TRIP_ID zusammen sind eindeutig und machen die Angabe der STR_LINE_VAR und LINE_DIR_NR nicht mehr notwendig
-> Funktioniert so gut und eindeutig, anders (ohne TRIP_ID im PK) wuerde es erst recht nie funktionieren.
Problem:
@d3d9
d3d9 / gpx-wkt.py
Last active May 9, 2020 21:10
GPX or TCX to WKT (MULTILINESTRING M)
import xml.etree.ElementTree as ET
from csv import writer
from datetime import datetime, timezone
from sys import argv
def parsefile(filename: str):
root = ET.parse(filename).getroot()
#wkt = "LINESTRING M ("
wkt = "MULTILINESTRING M (("
_xym = ""
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
from DINO import Version, Line, getlinetrips, readrestrictions, readallstops, printstops, csvstops
import pandas
from tqdm import tqdm
from collections import defaultdict
from datetime import timedelta
@d3d9
d3d9 / JourneyDetails
Last active August 20, 2019 08:47
DB Busradar NRW requests
POST
http://db-regio.hafas.de/bin/hci/mgate.exe
HTTP/1.1
User-Agent
: Dalvik/2.1.0 (Linux; U; Android 9; moto g(6) Build/PPS29.55-37-4)
Content-Type
: application/json;charset=UTF-8
Host
: db-regio.hafas.de
Connection