Skip to content

Instantly share code, notes, and snippets.

View cmrfrd's full-sized avatar
Just doing the beep boop

Alexander Comerford cmrfrd

Just doing the beep boop
View GitHub Profile
@cmrfrd
cmrfrd / client.py
Last active October 26, 2024 15:03
python exp_cloud client
import httpx
HOST = "https://dsapi.expcloud.com/odata/replication"
IMAGE_SERVICE_KEY = "..."
GET_TOKEN = "https://dsauth.expcloud.com/oauth2/token"
CLIENT_ID = "..."
SECRET = "..."
SCOPE = "..."
@cmrfrd
cmrfrd / jitter_calc.py
Created September 16, 2024 02:35
jitter calc
import numpy as np
from matplotlib import pyplot as plt
from tqdm import tqdm
data = []
num_refreshed_data = []
ITERATIONS = 5_000
N = 10_000
T = 100
@cmrfrd
cmrfrd / cursor.nix
Created August 25, 2024 19:29
cursor.nix
{pkgs, ...}: let
pname = "cursor";
version = "0.39.6";
src = pkgs.fetchurl {
url = "https://downloader.cursor.sh/linux/appImage/x64";
hash = "sha256-huZTzIZFAYtGRMhXGC+1sd0l2s5913QkWM+QjCtsEl0=";
# use this to update the hash
# nix hash to-sri --type sha256 $(nix-prefetch-url https://downloader.cursor.sh/linux/appImage/x64)
};
@cmrfrd
cmrfrd / visible_elements.ts
Created April 1, 2024 22:11
visibile_elements.ts
const clickableElements = await page.evaluate(async () => {
const resultElements: Elem[] = []
const clickables = [
'a',
'button',
'input',
'textarea',
'select',
'details',
'summary'
@cmrfrd
cmrfrd / gje.py
Last active October 2, 2023 18:55
Gaussian Jordan Elim for finding bithash collision
import numpy as np
np.random.seed(256)
DTYPE=np.int64
P = 101
def is_singular(matrix: np.ndarray) -> bool:
return np.isclose(np.linalg.det(matrix), 0)
def add(x, y, m): return (x + y) % m
def sub(x, y, m): return (x - y) % m
@cmrfrd
cmrfrd / grammar_sampling.py
Created August 13, 2023 06:34
grammar_sampling.py
from typing import Generator
import llama_cpp
import numpy as np
import regex
from lark import Lark, UnexpectedInput, UnexpectedToken
from llama_cpp import Llama
from pydantic import BaseModel, Field
import rstr
from itertools import islice
@cmrfrd
cmrfrd / gist:fe8f61da076f8a4a751bf8fc8cb579a5
Created December 28, 2022 04:12
ipad_screen_mirror_server
#! /usr/bin/env nix-shell
#! nix-shell --quiet -p uxplay -i bash
set -ueo pipefail
## Clear any existing "DROP ME" rules
## ref: https://stackoverflow.com/a/63855690/12393422
while sudo iptables -L -n --line-number | grep "DROP ME" > /dev/null; do
sudo iptables -D INPUT $(sudo iptables -L -n --line-number | grep "DROP ME" | head -1 | awk '{print $1}');
done
@cmrfrd
cmrfrd / bloop_use
Last active March 9, 2020 21:41
bloop_use
import time
import asyncio
import operator
from functools import wraps
from itertools import repeat, count
from aioitertools import iter as aiter
from aioitertools import islice
from peewee import *
from peewee import Expression
@cmrfrd
cmrfrd / bloob
Created March 9, 2020 21:28
bloop
import time
import asyncio
import operator
from functools import wraps
from itertools import repeat, count
from aioitertools import iter as aiter
from aioitertools import islice
from peewee import *
from peewee import Expression
@cmrfrd
cmrfrd / snake_string2.py
Last active March 3, 2020 23:10
snake_string2.py
import _collections_abc
from operator import itemgetter as _itemgetter, eq as _eq
from keyword import iskeyword as _iskeyword
import sys as _sys
from functools import wraps
MAX_DEPTH = 1024
class SnakeString(_collections_abc.Sequence):
"""