Skip to content

Instantly share code, notes, and snippets.

@zuriby
zuriby / contemplative-llms.txt
Created March 2, 2025 17:06 — forked from Maharshi-Pandya/contemplative-llms.txt
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
@zuriby
zuriby / pg-musk
Created February 5, 2025 17:07
Tweets-to-visit
Link: https://x.com/paulg/status/1887184325097242807?s=46
@zuriby
zuriby / grpo_demo.py
Created January 30, 2025 22:38 — forked from willccbb/grpo_demo.py
GRPO Llama-1B
# train_grpo.py
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
# Load and prep dataset
@zuriby
zuriby / FAQ.md
Created January 28, 2025 00:40 — forked from ngxson/FAQ.md
convert ARM NEON to WASM SIMD prompt

What is your setup?

Just chat.deepseek.com with prompts adapted from this gist.

Does it work in one-shot or I have to prompt it multiple times?

  • For the qX_0 variants, they are actually quite straight-forward so deepseek can come up with a correct result in 1 shot.
  • For the qX_K it's more complicated, I would say most of the time I need to re-prompt it 4 to 8 more times.
  • The most difficult was q6_K, the code never works until I ask it to only optimize one specific part, while leaving the rest intact (so it does not mess up everything)
@zuriby
zuriby / pg-book-sort.html
Created January 11, 2025 05:40
Sort image by its pixels colors
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pixel Sorter</title>
<style>
body {
font-family: system-ui, -apple-system, sans-serif;
max-width: 1200px;
@zuriby
zuriby / mandelbrot-set-viewer.html
Created January 4, 2025 02:17
Mandelbrot Set Viewer
<!DOCTYPE html>
<!--
Work by David Eck - Online version: https://math.hws.edu/eck/js/mandelbrot/MB.html
All credit to him!
I simply changed the worker to be loaded internally from the page, and minified the css and JS
Web page written by David Eck, https://math.hws.edu/eck/index.html
You can do anything you like with this web page and with the code, but
@zuriby
zuriby / mb.py
Created December 25, 2024 08:35
Mandelbrot Set Basic Viewer
# (c) copyright zuri bar yochay - [email protected]
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
class MandelbrotViewer:
def __init__(self):
self.max_iter = 100
self.xmin, self.xmax = -2, 1
self.ymin, self.ymax = -1.5, 1.5
@zuriby
zuriby / defaultdict.lua
Created June 6, 2020 14:10
lua implementaiton of python's default dict
function defaultdict(callable)
local T = {}
setmetatable(T, {
__index = function(T, key)
local val = rawget(T, key)
if not val then
rawset(T, key, callable())
end
return rawget(T, key)
end
@zuriby
zuriby / random-ipv4.sh
Created April 3, 2020 05:46
random ipv4
while true; do
ipv4=$(dd if=/dev/urandom bs=4 count=1 2>/dev/null | od -An -tu1 | sed -e 's/^ *//' | sed 's/ */./g')
echo $ipv4
done
@zuriby
zuriby / aggregate-cidr-addresses.pl
Created August 30, 2018 08:13 — forked from denji/README.md
Take a list of CIDR address blocks and combine them, for example, 192.168.0.0/24 and 192.168.1.0/24 gives 192.168.0.0/23. I usually use "list-iana-reserved-ranges | aggregate-cidr-addresses" to get a list of blocks to not report with firewall log processing. https://github.com/job/aggregate6
#!/usr/bin/perl
#
# aggregate-cidr-addresses - combine a list of CIDR address blocks
# Copyright (C) 2001,2007 Mark Suter <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#