Skip to content

Instantly share code, notes, and snippets.

View westandskif's full-sized avatar

Nikita Almakov westandskif

View GitHub Profile
~ ❯❯❯ rate-arch-mirrors --max-delay 21600
# JUMP #1
# EXPLORING US
# VISITED US
# + NEIGHBOR GB (by HubsFirst)
# + NEIGHBOR ID (by HubsFirst)
# + NEIGHBOR CN (by HubsFirst)
# + NEIGHBOR DE (by DistanceFirst)
# + NEIGHBOR CA (by DistanceFirst)
# + NEIGHBOR FR (by DistanceFirst)
@westandskif
westandskif / convtools-2021-03-28--01-slides.py
Last active April 8, 2021 06:29
convtools-2021-03-28-demo
from datetime import datetime
from decimal import Decimal
from convtools import conversion as c
# SLIDE 1
f = c.this().gen_converter()
f(1)
from datetime import datetime
from decimal import Decimal
from convtools import conversion as c
parse_date = c.call_func(datetime.strptime, c.this(), "%Y-%m-%d").call_method(
"date"
)
parse_decimal = c.call_func(
Decimal,
@westandskif
westandskif / tmp4.py
Last active April 5, 2022 05:25
so-71581296/pandas-dataframe-how-to-calculate-the-difference-by-first-row-and-last-row-and
import pandas as pd
from convtools import conversion as c
# tmp4.csv
"""
Category,CategoryName,time(s),Power,Vapor
1,A,1625448301,593233.36,3353.92
1,A,1625449552,595156.24,3286.8
1,A,1625450802,593833.36,3855.42
2,B,1625452051,595233.37,3353.95
@westandskif
westandskif / playground.py
Created April 14, 2022 15:06
how-can-i-use-pandas-explode-crosstab-and-count-number-of-occurence-for-large-d/71591146
from convtools import conversion as c
# fmt: off
input_data = [
{ "id": 1, "listElements": [ "apple", "peer", ["apple", "peer"], "banana", "chocolate", ["chocolate", "apple"], ], },
{ "id": 2, "listElements": [ "ginger", "peer", ["ginger", "sugar"], "tofu", ["tofu", "veggie"], "chocolate", ], },
{ "id": 3, "listElements": [ "steak", "beef", ["beef", "potatoes"], "banana", ], },
]
# fmt: on
@westandskif
westandskif / playground.py
Created August 19, 2022 10:44
codegen-medium-2022-08-19
from convtools import conversion as c
conversion = c.and_(
c.item(0) == b"abc",
c.item(2) > 15,
)
In [5]: converter = conversion.gen_converter(debug=True)
from convtools import conversion as c
config = {
"key1": "external key1",
"key2": "external key2",
"key3": "external key3",
}