Skip to content

Instantly share code, notes, and snippets.

View mil-ad's full-sized avatar
🍉

Milad Alizadeh mil-ad

🍉
View GitHub Profile
@anthonyrisinger
anthonyrisinger / flow-tool.go
Created September 26, 2025 03:44
The `flow-tool.go` is a testing and development utility and fake-streaming markdown renderer that generates, processes, and analyzes markdown content through Glamour. It supports flexible markdown primitive generation with customizable repetition and spacing, simulates various streaming modes (unbuffered, buffered, windowed) with artificial dela…
package main
import (
"bufio"
"flag"
"fmt"
"io"
"math/rand"
"os"
"slices"
@tjbcg
tjbcg / build_sioyek.sh
Last active August 19, 2025 18:35
An almost self-contained bash script that builds sioyek from scratch on macOS
#!/usr/bin/env bash
set -e
COLOR='\033[1;32m'
NC='\033[0m' # No Color
log() {
echo -e "${COLOR}#" $@ "${NC}"
}
@edwardmyung
edwardmyung / graphite-dev.md
Last active October 1, 2025 14:50
Graphite.dev Basic Guide

Graphite.dev

Why?

  • Stacked PRs allow you to easily work like so:
    • Work on branch ACQ-000-part-A (which is based on master)
    • Work on branch ACQ-000-part-B (which is based on part-A)
# Now available here: https://github.com/y0ast/pytorch-snippets/tree/main/subset_of_imagenet
# Now available here: https://github.com/y0ast/pytorch-snippets/tree/main/minimal_cifar
@sbarratt
sbarratt / torch_jacobian.py
Created May 9, 2019 19:40
Get the jacobian of a vector-valued function that takes batch inputs, in pytorch.
def get_jacobian(net, x, noutputs):
x = x.squeeze()
n = x.size()[0]
x = x.repeat(noutputs, 1)
x.requires_grad_(True)
y = net(x)
y.backward(torch.eye(noutputs))
return x.grad.data
import torch
def jacobian(y, x, create_graph=False):
jac = []
flat_y = y.reshape(-1)
grad_y = torch.zeros_like(flat_y)
for i in range(len(flat_y)):
grad_y[i] = 1.
grad_x, = torch.autograd.grad(flat_y, x, grad_y, retain_graph=True, create_graph=create_graph)
jac.append(grad_x.reshape(x.shape))
@talkingmoose
talkingmoose / New Daily Note.applescript
Last active April 23, 2022 02:33
Begins a new daily note for today in Bear. Adds a "Daily Notes" tag, events for today from Outlook 2016 for Mac calendar and a "Notes" header. Save this AppleScript to the Scripts folder for Bear at ~/Library/Scripts/Applications/Bear and call it using the system-wide AppleScript menu.
(*
----------------------------------------------------------------------------------
ABOUT THIS SCRIPT
Written by:William Smith
Professional Services Engineer
Jamf
[email protected]
@apaszke
apaszke / Rop.py
Last active January 16, 2023 07:20
def Rop(y, x, v):
"""Computes an Rop.
Arguments:
y (Variable): output of differentiated function
x (Variable): differentiated input
v (Variable): vector to be multiplied with Jacobian from the right
"""
w = torch.ones_like(y, requires_grad=True)
return torch.autograd.grad(torch.autograd.grad(y, x, w), w, v)

⚠️ this is now stupidly out of date

Computers

  • 13" Macbook Pro 3.3 GHz i7 (late 2016)
  • Microsoft Surface Book (2016)

Peripherals