This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Similar to json.dumps(obj, *, ensure_ascii=True) in Python | |
function encodeJsonUnicode(obj) { | |
return JSON.stringify(obj).replace(/[^\0-\x7F]/g, (c) => { | |
return '\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4); | |
}); | |
} | |
// decoding is simply JSON.parse(...); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @TODO this runs, but isn't fitting! | |
from dataclasses import dataclass | |
import torch | |
from torch import nn | |
@dataclass(frozen=True) | |
class ForecastPrediction: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from functools import lru_cache | |
from typing import Sequence, TypeVar | |
from fuzzywuzzy import fuzz | |
from unidecode import unidecode | |
T = TypeVar("T") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Does a depth of 10 | |
CREATE OR REPLACE PROCEDURE `mydataset`.connected_components_by_edge( | |
table_name STRING, | |
left_column STRING, | |
right_column STRING, | |
output_temp_table_name STRING | |
) | |
OPTIONS( | |
description="Connected components algorithm, clusters nodes by unidirected edges by the smallest node ID." | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// also checkout selenium wire https://pypi.org/project/selenium-wire/ | |
function interceptHttp(onComplete) { | |
// this will get rid of any previous interceptors, feel free to change | |
// this if you want to layer them. | |
window._old_send_ = window._old_send_ || window.XMLHttpRequest.prototype.send; | |
window._old_open_ = window._old_open_ || window.XMLHttpRequest.prototype.open; | |
window._old_setRequestHeader_ = window._old_setRequestHeader_ || window.XMLHttpRequest.prototype.setRequestHeader; | |
window.XMLHttpRequest.prototype.open = function () { | |
this._openArgs = [...arguments]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rand fill buffer: 3.894 GiB/s | Instant { tv_sec: 554538, tv_nsec: 411678934 } | Rand buffer beginning: [131, 217, 107, 91, 100, 45, 141, 113, 182, 115] | |
// Write speed: 7.058 GiB/s | 1.416909244s | Write buffer beginning: [131, 217, 107, 91, 100, 45, 141, 113, 182, 115] | |
// Read speed: 10.746 GiB/s | 930.555263ms | File beginning: [131, 217, 107, 91, 100, 45, 141, 113, 182, 115] | |
// Verified 0 bytes look incorrect | 28.545 GiB/s | 350.32772ms | |
// Hardware: raid-1 two SAMSUNG MZQL23T8HCLS-00A07 | |
// Capacity: 3.84 Tb | |
// Form Factor: U.2 | |
// Seq. Read: 6.333 GiB/s | |
// Ran. Read: 1000k Iops |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget https://cdn.geekbench.com/Geekbench-5.4.1-Linux.tar.gz | |
tar xvfz Geekbench-5.4.1-Linux.tar.gz | |
./Geekbench-5.4.1-Linux/geekbench_x86_64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function* createAsyncGenerator<T>( | |
createResource: (opts: { send: (value: T) => void, close: () => void }) => void, | |
reconnect?: () => Promise<void> | |
): AsyncGenerator<T, void, undefined> { | |
while (true) { | |
let closed = false; | |
let buffer: T[] = []; | |
let bufferHasData = createEvent(); | |
createResource({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import contextvars | |
import asyncio | |
from contextlib import asynccontextmanager | |
from typing import TypeVar | |
T = TypeVar("T") | |
@asynccontextmanager |
NewerOlder