Skip to content

Instantly share code, notes, and snippets.

# .cursorrules
Components & Naming
- Use functional components with `"use client"` if needed.
- Name in PascalCase under `src/components/`.
- Keep them small, typed with interfaces.
- Use Tailwind for common UI components like textarea, button, etc. Never use radix or shadcn.
Prisma
@AlcibiadesCleinias
AlcibiadesCleinias / gist:81e0214f7e125b8792a23bdab9d6383d
Created November 30, 2024 22:05
Redis: Load Dump into running Redis
# Create script
cat << 'EOT' > load-dump-redis.py
import redisdl
#json_text = '...'
#redisdl.loads(json_text)
with open('dump.json') as f:
# streams data if ijson or jsaone are installed
redisdl.load(f, host="redis")
@AlcibiadesCleinias
AlcibiadesCleinias / gist:00b9aaf8ec15bbbc73b34b454acdfba7
Created November 30, 2024 22:04
Redis: dump to json from python docker container
# Create simple dump script
cat << 'EOT' > dump-redis.py
import redisdl
#json_text = redisdl.dumps()
with open('dump.json', 'w') as f:
# streams data
redisdl.dump(f, host="redis")
EOT
@AlcibiadesCleinias
AlcibiadesCleinias / index.html
Created August 13, 2024 21:00
Make sure css and js are reloaded after update in Django Jinja templates
<!DOCTYPE html>
<html>
<head>
<title>Examples</title>
<script defer src="{% static 'web/js/deliveryCalculator.js' %}?debug={% now "U" %}" type="text/javascript"></script>
</head>
<body>
Hello world
</body>
</html>
@AlcibiadesCleinias
AlcibiadesCleinias / ai-clock.html
Created December 24, 2023 21:28
Obsidian AI - clock
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Clock</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
@keyframes rotate {
100% {
@AlcibiadesCleinias
AlcibiadesCleinias / Multicall3ContractClient.ts
Last active June 19, 2025 09:10
Multicall3 Contract Client Class on Typescript
// Resolve 2 TODOs and use multicall batch client.
import type { Interface, Result, ethers } from "ethers";
import { type IMulticall3 } from "../../index.js"; // TODO: use your import (in this example I used typechain types with multicall3 contract)
export type Multicall3ContractCall = { target: string, allowFailure: boolean, callData: string };
export type Aggregate3Response = { success: boolean; returnData: string };
export type TxResultsConverter<T> = (result: Result, ...opt: any[]) => T;
/*
* @description Client to be inherited from to work with Multicall3 contract to perform batch calls.
import os
from tqdm import tqdm
SUPPORTED_FORMATS = ['py']
directory = './src'
output_file = 'out.txt'
"""
I want to compare image (google to tg) and save tg edition in result folder
My case:
- google saved my photos (that I want to save) with ugly quality
- More of these photos are from telegram
- On my humble opinion in telegram quality of the photos is better
- What if I can go through google photos and try to replcace the ones with telegram one?
"""
import cv2
@AlcibiadesCleinias
AlcibiadesCleinias / walk_through_dir.py
Last active November 8, 2021 16:45
Walk through directory with filtering
base_path = '/Users/User/Documents'
files = [
os.path.join(dirpath, file) for (dirpath, subdirs, files) in os.walk(base_path) for file in files
if file.rsplit('.', 1)[-1].lower() in ['js']
]