I hereby claim:
- I am xevix on github.
- I am xevix (https://keybase.io/xevix) on keybase.
- I have a public key ASDKzeeW4q_b8UXMKqF-posWghvBE63A41Msr3QCiHTrxwo
To claim this, I am signing this object:
import pandas as pd | |
import duckdb | |
import pygrib | |
import sys | |
# Testing data from: https://data.ecmwf.int/forecasts/20250211/00z/aifs/0p25/oper/ | |
# ECMWF is the European Centre for Medium-Range Weather Forecasts. | |
def grib_to_df(grb): | |
attrs = str(grb).split(":") |
-- Tested on 2024 MBP M4 Max 128G RAM 16 cores (12P, 4E), DuckDB 1.1.3, Sequoia 15.1 | |
-- Taxi data set: https://www.nyc.gov/site/tlc/about/tlc-trip-record-data.page | |
-- Inspired by: https://duckdb.org/2024/10/16/driving-csv-performance-benchmarking-duckdb-with-the-nyc-taxi-dataset.html | |
-- taxi_data_2019: ~84M rows | |
-- UNPIVOT (naive) | |
-- ~5500ms (1.1.3) | |
-- ~4500ms (1.2) | |
-- ~330ms (2025/02/13 git HEAD) https://github.com/duckdb/duckdb/pull/16221 | |
WITH locations AS ( |
fname = 'pwned-passwords-2.0.txt' | |
# Change me | |
# echo -n password | shasum -a 1 | awk '{print toupper($1)}' | |
password = '7C4A8D09CA3762AF61E59520943DC26494F8941B' | |
search = password | |
with open(fname) as f: | |
for line in f: | |
sha = line[:40] | |
if search == sha: |
I hereby claim:
To claim this, I am signing this object:
trait Folder { | |
type Item; | |
fn foldl1<F>(self, f: F) -> Option<Self::Item> | |
where | |
F: FnMut(Self::Item, &Self::Item) -> Self::Item; | |
} | |
impl<T: Clone> Folder for Vec<T> { | |
type Item = T; | |
fn foldl1<F>(self, mut f: F) -> Option<Self::Item> |
pub fn combine_all_option<T>(xs: &Vec<T>) -> Option<T> | |
where | |
T: Semigroup + Clone, | |
{ | |
match xs.first() { | |
Some(head) => { | |
// Dear lord this reads horribly | |
xs[1..].iter().fold(Some((*head).clone()), |acc, x| acc.combine(&Some((*x).clone()))) | |
} | |
_ => None |
def main(): | |
ary = ['I should never print'] | |
for elem in ary: | |
pass | |
other_ary = ['other'] | |
for other_elem in other_ary: | |
# "elem" hould not be defined here, but this works, because of Python's awful scoping rules |
def foo(a, b={}): | |
if a == 1: | |
b["oops"] = "boom" | |
return b | |
for i in xrange(3): | |
print "foo: {}".format(foo(i)) | |
# Output: |
def foo(bob, **kwargs): | |
pass | |
kwargs = {'bob': 'first param is also bob, when splatted, they clash...'} | |
foo('bar', **kwargs) # KABOOM! | |
# Traceback (most recent call last): | |
# File "<stdin>", line 1, in <module> | |
# TypeError: foo() got multiple values for keyword argument 'bob' |
struct Foo { | |
x: i32, | |
} | |
struct Bar<'a> { | |
foo: &'a Foo, | |
// Uncomment to disallow drop() | |
x: ::std::cell::RefCell<() /* Option<&'a Bar<'a>>*/>, | |
} |