Skip to content

Instantly share code, notes, and snippets.

@ddh0
ddh0 / train.py
Created February 6, 2025 19:46
Janky pretraining script for small llama models using HF fineweb - modify according to your needs
import os
import torch
import psutil
import datasets
import glob
from transformers import (
AutoTokenizer, LlamaConfig, LlamaForCausalLM, Trainer, TrainingArguments,
DataCollatorForLanguageModeling
)
@VictorTaelin
VictorTaelin / ai_reasoning_challenge_v2.md
Last active April 17, 2025 08:38
INVERT A BINARY TREE - $10k AI REASONING CHALLENGE (v2)

THE PROBLEM

🌲 Invert a binary tree! 🌲

Except with 3 catches:

  1. It must invert the keys ("bit-reversal permutation")
  2. It must be a dependency-free, pure recursive function
  3. It must have type Bit -> Tree -> Tree (i.e., a direct recursion with max 1 bit state)
@JarbasAl
JarbasAl / triples.py
Last active December 4, 2024 01:54
extract triples with spacy and https://spacy.io/universe/project/coreferee
from typing import Tuple, Dict, List
import spacy
from spacy.cli import download
from spacy.tokens import Token
class DependencyParser:
def __init__(self):
self.NEGATION = {"no", "not", "n't", "never", "none"}
@hdary85
hdary85 / gui22
Created November 30, 2023 04:26
import tkinter as tk
from tkinter import simpledialog, messagebox
class NestedDictManager:
def __init__(self, root, data):
self.root = root
self.root.title("Nested Dictionary Manager")
self.data = data # Use the provided dictionary
self.tree = tk.ttk.Treeview(self.root)
import tkinter as tk
from tkinter import simpledialog, messagebox
class NestedDictManager:
def __init__(self, root):
self.root = root
self.root.title("Nested Dictionary Manager")
self.data = {
'key1': 'value1',
@rain-1
rain-1 / GPT-4 Reverse Turing Test.md
Last active October 8, 2024 02:59
GPT-4 Reverse Turing Test

The reverse turing test

I asked GPT-4 to come up with 10 questions to determine if the answerer was AI or human.

I provided my own answers for these questions and I also asked ChatGPT to answer them.

The result is that GPT-4 was able to correctly differentiate between AI and Human.

#!/usr/bin/env bash
set -e
# pj-append.bash is a timestamped log file for you, a human. Set up a cron job to launch it every
# hour to note what you were working on, or append lines from the terminal whenever you're chewing
# on a hard problem.
#
# Use the data to build a picture of what you worked on during the last week, or grep
# last quarter's log to find out why you decided to use library A instead of library B.
#
@amunchet
amunchet / noVNCCopyPasteProxmox.user.js
Last active April 24, 2025 04:56
Copy/Paste for noVNC Proxmox
// ==UserScript==
// @name noVNC Paste for Proxmox
// @namespace http://tampermonkey.net/
// @version 0.2a
// @description Pastes text into a noVNC window (for use with Proxmox specifically)
// @author Chester Enright
// @match https://*
// @include /^.*novnc.*/
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @grant none
@utkarsharma2
utkarsharma2 / fabricate_dag.py
Created April 1, 2021 13:54
Dynamically Create Airflow DAG(s) via JSON.
"""Dag Factory"""
from datetime import datetime
from airflow import DAG
def create_dag(schedule, default_args, definition):
"""Create dags dynamically."""
with DAG(
definition["name"], schedule_interval=schedule, default_args=default_args
) as dag:
@tykurtz
tykurtz / grokking_to_leetcode.md
Last active April 23, 2025 01:57
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window