Skip to content

Instantly share code, notes, and snippets.

@migurski
migurski / _index.ipynb
Last active February 21, 2024 00:43
Felt API + Jupyter Notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import datetime
import math
import mercantile
import pytz
import suncalc
def date(yyyy, mm, dd, hh):
dt_naive = datetime.datetime(yyyy, mm, dd, int(hh), int((60 * hh) % 60))
dt_local = dt_naive.astimezone(pytz.timezone('America/Los_Angeles'))
dt_utc = dt_local.astimezone(pytz.utc)
@migurski
migurski / weather2calendar.py
Created January 15, 2024 18:26
Pirate Weather → iCal & JSON Script
#!/usr/bin/env python3
import datetime
import json
import os
import sys
import gzip
import ics
import requests
import pytz
@migurski
migurski / README.txt
Created January 13, 2024 06:26
Twitter archive README content
INTRODUCTION
============
This archive was generated at the request of the following user:
- @username at the time the archive was generated: migurski
- Account ID: 2790981
The easiest way to navigate your archive is to open the HTML renderer in a desktop web browser by double clicking the “Your archive” file included in the main folder once the archive is unzipped.
Note that the HTML renderer only works if the archive is less than 50GB. Also note that the HTML renderer only includes a subset of the data included in the archive. To see all the data included in the archive, please navigate the JSON files located in the “data” folder.
@migurski
migurski / index.ipynb
Created December 4, 2023 02:10
Ghana test with Geoparquet
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@migurski
migurski / places.sql
Last active August 1, 2023 16:43
Overture query examples for five major world cities
SELECT
categories.main AS main_category,
names['common'][1]['value'] AS common_name,
confidence,
ST_AsText(ST_GeomFromBinary(geometry)) AS wkt,
confidence,
CASE WHEN ST_Within(ST_GeomFromBinary(geometry), ST_GeometryFromText('POLYGON ((0.905301687393953 47.895747559191,3.79669831260605 47.895747559191,3.79669831260605 49.79817987169,0.905301687393953 49.79817987169,0.905301687393953 47.895747559191))')) THEN 'Paris'
WHEN ST_Within(ST_GeomFromBinary(geometry), ST_GeometryFromText('POLYGON ((75.7827016873939 27.3583247590675,78.674098312606 27.3583247590675,78.674098312606 29.8959350440702,75.7827016873939 29.8959350440702,75.7827016873939 27.3583247590675))')) THEN 'New Delhi'
WHEN ST_Within(ST_GeomFromBinary(geometry), ST_GeometryFromText('POLYGON ((138.325301687394 34.5021508791562,141.216698312606 34.5021508791562,141.216698312606 36.8505684661713,138.325301687394 36.8505684661713,138.325301687394 34.5021508791562))')) THEN 'Tokyo'
WHEN ST_Within(ST_GeomFromBinary(geometry), ST_Geom
import re
import sys
import numpy
import shapely.geometry
import shapely.ops
import bezier
moveto_pat = re.compile(r'^M(?P<x>-?\d+(\.\d+(e-?\d+)?)?),(?P<y>-?\d+(\.\d+(e-?\d+)?)?)(\s+(?P<tail>.+))?$')
lineto_pat = re.compile(r'^L(?P<x>-?\d+(\.\d+(e-?\d+)?)?),(?P<y>-?\d+(\.\d+(e-?\d+)?)?)(\s+(?P<tail>.+))?$')
curveto_pat = re.compile(r'''
import re
import cairo
import bezier
import numpy
import itertools
# https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#path
paths = [
'''M500.04,309.630308 C817.696558,309.630308 931.823304,522.666719 936.58,532.180112 L936.58,549.295931 C931.824662,557.855539 817.696558,770.894667 500.04,770.894667 C182.383442,770.894667 68.2566964,557.858256 63.5,548.344863 L63.5,531.229044 C68.2553377,522.669436 182.383442,309.630308 500.04,309.630308 Z M520.015815,422.809043 L520.015815,422.806648 C524.766058,399.02996 514.304315,374.305261 494.342086,360.983862 L494.342086,360.035189 C475.315641,360.991352 456.295139,367.645088 440.12784,378.107171 C424.909061,388.570612 412.543655,402.840022 403.985575,419.955841 C407.793242,444.686993 425.863525,464.656354 450.589583,469.413051 C482.924181,476.067127 513.355115,455.143641 520.015815,422.809043 Z M357.379869,438.976342 L357.373076,438.975833 C364.033945,404.737401 383.053598,375.254308 409.690282,354.330822 C375.451851,359.086159 344.064924,367.644748 3
@migurski
migurski / OSMF-2021-Survey.qgz
Last active February 27, 2021 00:03
OSMF 2021 Survey Regions
@migurski
migurski / generate-boards.py
Created May 17, 2020 18:33
Generate Codenames board in Google Sheets
#!/usr/bin/env python3
import json
import random
import copy
import argparse
import oauth2client.service_account
import apiclient.discovery
parser = argparse.ArgumentParser()
parser.add_argument('players')