Skip to content

Instantly share code, notes, and snippets.

View andrashann's full-sized avatar

andrashann

View GitHub Profile
@andrashann
andrashann / cl.sh
Last active February 16, 2024 19:30
Command line notes – a collection of useful one-liners
# Copyright 2019 A. H.
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@andrashann
andrashann / gpxbuffer.ipynb
Created August 24, 2023 20:43
take a gpx track file and a gpx file with waypoints and keep only the points within a certain buffer of the track
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<template>
<div>
<div class="range_container">
<div class="sliders_control">
<input
id="fromSlider"
v-model="fromVal"
type="range"
:min="min"
:max="max"
@andrashann
andrashann / hungary_road_numbers.ipynb
Created February 19, 2022 12:21
Notebook to create a map highlighting the first digit of road numbers in Hungary
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andrashann
andrashann / get-osm-country-borders.sh
Created November 4, 2022 18:01
get country borders from planet-latest.osm.pbf openstreetmap export using osmium into a geojson file
# on a Mac: brew install osmium-tool
# get relations with boundary=administrative tag, use -t to throw away unneeded tag info
# (otherwise a bunch of unneeded objects remain)
osmium tags-filter -t -o bound.osm.pbf planet-latest.osm.pbf r/boundary=administrative
# same, but filtering futher for admin_level=2
osmium tags-filter -t -o admin_level_2.osm.pbf bound.osm.pbf r/admin_level=2
#convert to geojson for further processing
osmium export admin_level_2.osm.pbf -o admin_level_2.geojson
@andrashann
andrashann / hochschwab.ipynb
Created July 28, 2022 18:47
hochschwab hike comparison
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andrashann
andrashann / cmap_map.py
Created October 17, 2020 13:49
Companion notebook to my article about population density and social distancing
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
#https://scipy-cookbook.readthedocs.io/items/Matplotlib_ColormapTransformations.html
def cmap_map(function, cmap):
""" Applies function (which should operate on vectors of shape 3: [r, g, b]), on colormap cmap.
This routine will break any discontinuous points in a colormap.
"""
@andrashann
andrashann / Tram 6 renovation visualization.ipynb
Last active June 17, 2020 21:34
A time-space graph showing construction works on tram line 6 in Budapest. This code is released under the MIT license.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.