Skip to content

Instantly share code, notes, and snippets.

➜ eventgroup git:(main) ✗ uv run python matcher.py data/answers.csv 4
Person 1 is more similar to...
- Person 5, with a similarity of 0.8963876720217021
- Person 3, with a similarity of 0.8905567720281826
- Person 4, with a similarity of 0.8882988656868803
- Person 6, with a similarity of 0.8535375789847595
- Person 2, with a similarity of 0.8311989560377757
- Person 9, with a similarity of 0.8286727973358272
- Person 8, with a similarity of 0.8182674031453949
- Person 7, with a similarity of 0.8158040760765586
Given a directory path in a file system, implement a library that is able to recursively find the file with the same content.
As long as the contents are the same, group them. The filename can be different
If a file has unique content that no other file has, exclude it.
Instruction:
- Implement `FileNode` class that can represent the example above
- Build test cases based on example, and run the code
- Group the files that have same content in a two dimensional array
Example:
@pappacena
pappacena / snowflake-upload-xor-model.py
Created April 4, 2024 18:31
snowflake-upload-xor-model.py
import os
import time
import torch
from snowflake.ml.registry import Registry
from snowflake.snowpark import Session
DEVICE = "cuda"
@pappacena
pappacena / landingai-sdk-definitions.py
Last active February 23, 2024 18:03
Landing.ai lib/SDK definitions
"""
General guidelines for LandingLens client:
- Types should match what users see in the Web UI, and should be defined at `landingai.types`
- Each entity represented in the UI should have a unique identifier, preferrably a single attribute
- If the entity has a compound ID that references another entity (snapshot, for example, has its
own ID and the project ID), we should allow users to refer to the outer entity ID by its ID *OR*
by the entity itself. For example:
`Snapshot(id=111, project_id=222)` or `Snapshot(id=111, project=Project(id=222))`
- Methods names should preferrably follow this naming convertion:
- get_xxxx(identifier) -> Something: Get a single instance of something that exists in the UI
@pappacena
pappacena / android_inference.py
Created October 7, 2022 22:16
Stream images from camera and run inferences using a pre-trained pytorch model
import ast
import time
import torch
import numpy as np
from torchvision import models, transforms
import cv2
from PIL import Image
import requests
swipe:
2:
left:
command: 'xdotool key Alt+Left'
right:
command: 'xdotool key Alt+Right'
3:
left:
command: 'xdotool key super+Shift+Right'
right:
@pappacena
pappacena / atom-settings
Created September 12, 2017 13:04
Atom settings
a
version: '2'
services:
app:
build: app
command: python manage.py runserver 0:8000
environment:
- DEBUG=true
ports:
- 8003:8000
app:
build: app
command: python manage.py runserver 0:8000
volumes:
- ./app:/usr/src/app
environment:
- DEBUG=true
ports:
- 8003:8000
links:
version: '2'
services:
app:
build: app
command: python manage.py runserver 0:8000
volumes:
- ./app:/usr/src/app
environment:
- DEBUG=true