Skip to content

Instantly share code, notes, and snippets.

View matthiasgoergens's full-sized avatar

Matthias Görgens matthiasgoergens

View GitHub Profile
@matthiasgoergens
matthiasgoergens / OlaVM clippy complaints.txt
Created January 18, 2024 03:10
OlaVM clippy complaints
~/m/p/o/olavm (main)$ git rev-parse HEAD && cargo clippy
d9fc2ff0a465f31dfd90f93dd3e02053818fe0d6
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
warning: suspicious use of `*` in `Div` impl
--> plonky2/field/src/arch/x86_64/avx2_goldilocks_field.rs:86:14
|
86 | self * rhs.inverse()
~/m/p/o/olavm (main)$ git rev-parse HEAD && cargo clean && cargo check
d9fc2ff0a465f31dfd90f93dd3e02053818fe0d6
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
Removed 2782 files, 1.7GiB total
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
17
23
function FindProxyForURL(url, host) {
PROXY = "SOCKS 127.0.0.1:1337"
if (shExpMatch(host,"*.pandora.com")) {
return PROXY;
}
return "DIRECT";
}
#!/usr/bin/env python3
from collections import defaultdict
from datetime import datetime, timedelta
import requests
from bisect import bisect_left
from typing import List, Dict, Any
from bisect import bisect
@matthiasgoergens
matthiasgoergens / bools.py
Created August 29, 2022 08:31
Booleans in Python
class A:
def __init__(self, x):
self.x = x
def __bool__(self):
print(f'bool: {self}')
return False
def __str__(self):
return f'A(x={self.x})'
print("Variant 1")
@matthiasgoergens
matthiasgoergens / nextafter.py
Last active April 25, 2023 11:36
math.nextafter with steps as a pure Python prototype
import math
import struct
from functools import reduce
from itertools import repeat
from hypothesis import assume, example, given, note
from hypothesis import strategies as st
def float_from_integer(integer):
@matthiasgoergens
matthiasgoergens / match.py
Created June 27, 2022 06:40
Match subsets with same sum
"""
https://www.reddit.com/r/algorithms/comments/vi75ip/equal_sums_for_subsets_of_2_different_lists/
For example, lets say you have a warehouse and you want to keep a record of the merchandise, bananas, that goes in and out. If you have two people keeping records and they work independently, we would expect them to have the same recorded values and that their records will be identical. However, it is possible that one person created one record for two shipments, creating a sum that I want to detect here. It is also possible that one person miss counted and that value should not have a matching element to the other person's records. Ultimately, it is erroneous and non-matching entries that I want to identify. If they do not match, then we know there was a recording error somewhere and we need to investigate that.
I'm trying to reconcile those records. First, I remove all entries that do match up perfectly. Then, I need to find out if there is some combination of records for person A that matches up with some
@matthiasgoergens
matthiasgoergens / parens.py
Last active June 1, 2022 12:26
Check whether parens are matched in a string
import re
from hypothesis import strategies as st, given, assume, note, example
from typing import List, Optional
def is_balanced(mystr):
if len(mystr) % 2 != 0:
return False
stack = []
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Control.Monad.Trans.RWS.Strict
import Control.Monad
newtype Stitch = Stitch Int
deriving (Eq, Ord, Show, Num)
type Knitting a = RWS () [Stitch] Stitch a
emitRow :: Knitting ()