Skip to content

Instantly share code, notes, and snippets.

@savarin
savarin / bplustree.py
Last active April 28, 2024 23:04
Python implementation of a B+ tree
"""Simple implementation of a B+ tree, a self-balancing tree data structure that (1) maintains sort
data order and (2) allows insertions and access in logarithmic time.
"""
class Node(object):
"""Base node object.
Each node stores keys and values. Keys are not unique to each value, and as such values are
stored as a list under each key.
@denilsonsa
denilsonsa / README.md
Last active April 28, 2024 23:01
Bundle Helper
@f0ster
f0ster / accelerate_presharder.py
Created April 28, 2024 14:08
CLI for sharding and publishing models to huggingface
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from accelerate import Accelerator
import os
import argparse
def main():
# Parse command line arguments
args = parse_args()
@flavienbonvin
flavienbonvin / dynamic_imports.tsx
Created March 29, 2022 18:28
NextJS optimisation gist
const ServiceBadge = dynamic(() => import(../Molecules/ServiceBadge’))
const ServiceHeader = ({service, title}: Props) => {
const router = useRouter()
const isMobile = useBreakpointValue([true, null, false], ‘base’)
return (
<HStack>
<BackButton onClick={() => router.replace(ROUTE_ROOT)} />
{isMobile && <ServiceBadge {…service} />}
@luizomf
luizomf / upscale_1080p_to_4k_using_ffmpeg.md
Last active April 28, 2024 22:58
Upscale 1080p to 4k using ffmpeg

Upscale 1080p to 4k using ffmpeg

Just use the command below:

ffmpeg -i INPUT_FILE \
  -vf scale=3840x2160:flags=lanczos \
  -c:v libx264 \
  -crf 13 \
 -c:a aac -b:a 512k \
@bramtechs
bramtechs / upgrade-debian-wsl.md
Last active April 28, 2024 22:55
Upgrade Debian 9, (current WSL) to Debian 12 (bookworm testing)

Upgrade Debian 9 (current WSL) to Debian 12 (bookworm testing)

Note: I do not maintain this gist anymore, but people report that it still works. Please check the comments for any revisions or extra things you should take into consideration.

As of writing, the Debian distro for WSL (Windows Subsystem for Linux) is quite old.

You can get more up-to-date package managers, text-editors and compilers by upgrading WSL to Debian 12 (current testing).

  • Root required
  • Use at your own risk, preferably on a fresh installation.
@kepano
kepano / obsidian-web-clipper.js
Last active April 28, 2024 22:51
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@h3ssan
h3ssan / JetBrains trial reset.md
Last active April 28, 2024 22:48
Reset all JetBrains products trial in Linux

In some cases, only these lines will work

for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine; do
    rm -rf ~/.config/$product*/eval 2> /dev/null
    rm -rf ~/.config/JetBrains/$product*/eval 2> /dev/null
done

But if not, try these

@jhoblitt
jhoblitt / gist:9adaf95b0550f3be7a4b1ef06054d1a0
Created January 4, 2017 02:54
crossover manual license install
This operation must be run as root:
/opt/cxoffice/bin/cxregister --install /tmp/license.txtF1JK_F /tmp/license.sigaE5XnZ
@khattaksd
khattaksd / seed.sql
Created September 22, 2023 00:19
Supabase Seed Users for local development & testing
-- supabase/seed.sql
--
-- create test users
INSERT INTO
auth.users (
instance_id,
id,
aud,
role,
email,