This file contains hidden or 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 { WarpGrepClient } from "@morphllm/morphsdk"; | |
| import { tool } from "@opencode-ai/plugin/tool"; | |
| import { promises as fs } from "fs"; | |
| import { resolve } from "path"; | |
| const z = tool.schema; | |
| const MAX_RETRIES = 3; | |
| const BASE_DELAY_MS = 250; | |
| const MAX_CONTEXTS = 20; |
This file contains hidden or 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
| # Upsert function for pandas to_sql with postgres | |
| # https://stackoverflow.com/questions/1109061/insert-on-duplicate-update-in-postgresql/8702291#8702291 | |
| # https://www.postgresql.org/docs/devel/sql-insert.html#SQL-ON-CONFLICT | |
| import pandas as pd | |
| import sqlalchemy | |
| import uuid | |
| import os | |
| def upsert_df(df: pd.DataFrame, table_name: str, engine: sqlalchemy.engine.Engine): |
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 hidden or 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
| from io import StringIO | |
| import psycopg2 | |
| from tqdm import tqdm | |
| def copy_from(df: pd.DataFrame, | |
| table: str, | |
| connection: psycopg2.extensions.connection, | |
| chunk_size: int = 10000): |
This file contains hidden or 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
| removecontainers() { | |
| docker stop $(docker ps -aq) | |
| docker rm $(docker ps -aq) | |
| } | |
| armageddon() { | |
| removecontainers | |
| docker network prune -f | |
| docker rmi -f $(docker images --filter dangling=true -qa) | |
| docker volume rm $(docker volume ls --filter dangling=true -q) |
This file contains hidden or 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 sys | |
| import yaml | |
| import argparse | |
| class ConfigParser(): | |
| def __init__(self, *pargs, **kwpargs): | |
| self.options = [] | |
| self.pargs = pargs | |
| self.kwpargs = kwpargs |
This file contains hidden or 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 subprocess | |
| videofile = 'crowd_trimmed.mp4' | |
| cmds = [ | |
| '--maxCorners=10', '--maxCorners=50', '--maxCorners=100', | |
| '--qualityLevel=0.1', '--qualityLevel=0.8', '--minDistance=2', | |
| '--minDistance=40', '--winSize=5', '--winSize=100', '--blockSize=2', | |
| '--blockSize=20', '--criteria_params1=5', '--criteria_params1=20', | |
| '--criteria_params2=0.01', '--criteria_params2=0.08', |
This file contains hidden or 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
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| # Python script to find the largest files in a git repository. | |
| # The general method is based on the script in this blog post: | |
| # http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/ | |
| # | |
| # The above script worked for me, but was very slow on my 11GB repository. This version has a bunch | |
| # of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects. | |
| # |
This file contains hidden or 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
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |