Skip to content

Instantly share code, notes, and snippets.

View walkingpendulum's full-sized avatar

walkingpendulum walkingpendulum

View GitHub Profile
from enum import Enum
from pydantic import BaseModel, Field
from typing import Union
# Artur:
{
"boundary": "geojson",
"changedBy": "string",
"integrationId": "string"
haystack = [1, 2, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6]
needle = [2, 1, 2]
def cut_substr_once(substr, string):
substr_size = len(substr)
for ind, _ in enumerate(string):
if substr == string[ind: ind + substr_size]:
return string[:ind], string[ind + substr_size:]
{
"type": "FeatureCollection",
"metadata": {
"name": "rent 2021",
"creator": "Yandex Map Constructor"
},
"features": [
{
"type": "Feature",
"geometry": {
import os
import pathlib
from selenium import webdriver
from selenium.webdriver.chrome.options import Options as ChromeOptions
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webdriver import WebDriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
@walkingpendulum
walkingpendulum / text.txt
Last active July 1, 2020 17:30
comics #2
V 2
[1. FACTORY DEMOLISHING SCENE]
As you might know, the Alpha team started
Demolishing the Workflow Worker Factory
The most significant part of the tiling department
has already been destroyed.
[2. TV SCENE]
Sounds scary, but the factory now consumes N times less energy and significantly decreased the amount of exhaust fumes.
@walkingpendulum
walkingpendulum / gist:710e47853da3661b7b3aca5becd695db
Created December 4, 2019 10:41
gdalinfo assumed and assumed>global>assumed diff
# diff -y <(gdalinfo alpha-48-manual-buffalo-preprocessed-data-2019-11-01-dem.scan.tms.float.assumed-2276-assumed.tif) <(gdalinfo alpha-48-manual-buffalo-preprocessed-data-2019-11-01-dem.scan.tms.float.assumed.tif)
Driver: GTiff/GeoTIFF Driver: GTiff/GeoTIFF
Files: alpha-48-manual-buffalo-preprocessed-data-2019-11-01-d | Files: alpha-48-manual-buffalo-preprocessed-data-2019-11-01-d
Size is 3355, 3692 Size is 3355, 3692
Coordinate System is: Coordinate System is:
PROJCS["NAD83 / Texas North Central (ftUS)", | LOCAL_CS["unnamed",
GEOGCS["NAD83", | UNIT["foot",0.3048,
DATUM["North_American_Datum_1983", | AUTHORITY["EPSG","9002"]]]
SPHEROID["GRS 1980",6378137,298.257222101, | Origin = (2499916.634541186038405,7183205.565398516133428)
AUTHORITY["EPSG","7019"]], | Pixel Size = (0.300000011920929,-0.300000011920929)
@walkingpendulum
walkingpendulum / inner_points.py
Last active December 18, 2018 21:13
check if point belongs to polygon
# coding: utf-8
import cmath
import unittest
from itertools import chain
def eq_to_zero(x, eps=1e-7):
return abs(x) < eps
@walkingpendulum
walkingpendulum / test.py
Created August 5, 2018 13:49
multiprocessing: shared mem vs separate mem
"""
$ dd if=/dev/urandom of=sample.txt bs=16M count=1
$ python test.py
shared:
process 44666, memory 1M
process 44667, memory 1M
process 44668, memory 1M
total: 9M
separate:
class Tuple(tuple):
def __setitem__(self, key, value):
print('tuple setitem', key, value)
super().__setitem__(key, value)
def __getitem__(self, item):
print('tuple getitem', item)
return super().__getitem__(item)
import time
from itertools import zip_longest
import random
from multiprocessing import Process
def f(inflow_cache):
time.sleep(random.randint(2, 5))
inflow_cache = list(filter(lambda t: t is not None, inflow_cache))