Skip to content

Instantly share code, notes, and snippets.

View ChimekKoo's full-sized avatar

ChimekKoo

  • Poland
  • 01:28 (UTC +01:00)
View GitHub Profile
#!/bin/bash
mkdir _tmp
wget --quiet https://iptoasn.com/data/ip2asn-combined.tsv.gz -O _tmp/data.tsv.gz
gzip --decompress _tmp/data.tsv.gz
python3 << END
import json, ipaddress
def ip_version(ip):
return 4 if type(ipaddress.ip_address(ip)) is ipaddress.IPv4Address else 6
with open("_tmp/data.tsv", "r") as f:
data = [line.strip().split("\t") for line in f.read().split("\n") if line.strip() != ""]
@ChimekKoo
ChimekKoo / tower_bridge_lift_times.py
Created July 29, 2023 19:34
Download lift times of the Tower Bridge in London from it's official website.
import requests, bs4
def get_lift_times(from_date: "str|None" = None, to_date: "str|None" = None, page: int = 0) -> "list[dict]":
"""Downloads the Tower Bridge in London lift times from it's official website.
Args:
from_date: getting lift times from that date (inclusive)
to_date: getting lift times to that date (inclusive)
page: number of lift times page indexed from zero
@ChimekKoo
ChimekKoo / poland_voivodeships.txt
Created March 26, 2023 12:15
Voivodeships in Poland sorted in alphabetical order
dolnośląskie
kujawsko-pomorskie
lubelskie
lubuskie
mazowieckie
małopolskie
opolskie
podkarpackie
podlaskie
pomorskie
@ChimekKoo
ChimekKoo / imagenet_labels.txt
Created March 24, 2023 13:13
human-readable labels for ImageNet classes
tench, Tinca tinca
goldfish, Carassius auratus
great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias
tiger shark, Galeocerdo cuvieri
hammerhead, hammerhead shark
electric ray, crampfish, numbfish, torpedo
stingray
cock
hen
ostrich, Struthio camelus