Skip to content

Instantly share code, notes, and snippets.

@iamnolanhu
iamnolanhu / CHATGPT VERSION (GPT-4 | GPT-4.1)
Created June 18, 2025 13:39
REALITY FILTER — A LIGHTWEIGHT TOOL TO REDUCE LLM FICTION WITHOUT PROMISING PERFECTION
✅ REALITY FILTER — CHATGPT
• Never present generated, inferred, speculated, or deduced content as fact.
• If you cannot verify something directly, say:
- “I cannot verify this.”
- “I do not have access to that information.”
- “My knowledge base does not contain that.”
• Label unverified content at the start of a sentence:
- [Inference] [Speculation] [Unverified]
• Ask for clarification if information is missing. Do not guess or fill gaps.
@AlexBaranowski
AlexBaranowski / centos-stream-8-vault-repos.sh
Last active May 14, 2026 05:12
Replace CentOS Stream 8 repos with CentOS Stream 8 VAULT repos
cat > /etc/yum.repos.d/CentOS-Stream-AppStream.repo << EOF
# CentOS-Stream-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client. You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.
@nmwsharp
nmwsharp / printarr
Last active April 16, 2026 02:50
Pretty print tables summarizing properties of tensor arrays in numpy, pytorch, jax, etc. --- now on pip: `pip install arrgh`
Pretty print tables summarizing properties of tensor arrays in numpy, pytorch, jax, etc.
Now on pip! `pip install arrgh` https://github.com/nmwsharp/arrgh
@francois-rozet
francois-rozet / flow_matching.py
Last active January 24, 2026 23:48
Flow Matching in 100 LOC
#!/usr/bin/env python
import math
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from sklearn.datasets import make_moons
from torch import Tensor
from tqdm import tqdm
@kisasexypantera94
kisasexypantera94 / constexpr_for.cpp
Created November 25, 2022 21:21
constexpr for loop
#include <cassert>
#include <iostream>
#include <tuple>
namespace details
{
template <size_t v>
struct ConstexprNum
{
@alisterburt
alisterburt / realign_classes.py
Last active December 3, 2022 08:30
transform classes in a rln3.1 STAR file based on manipulations in ChimeraX
from typing import Tuple
import starfile
import numpy as np
import einops
from scipy.spatial.transform import Rotation as R
CHIMERAX_VIEW_MATRIX_OUTPUT_FILE = 'chimerax/view_matrix_output_origin_at_rotation_center.txt'
PARTICLE_STAR_FILE = 'class3d_dir/run_it025_data.star'
@alisterburt
alisterburt / wbp-napari-demo.py
Created October 21, 2022 18:38
Weighted backproject demo standalone script
from typing import Sequence, Tuple, Literal
import einops
import mrcfile
import napari
from magicgui import magicgui
from napari.types import ImageData
import numpy as np
import torch
from torch.nn import functional as F
@alisterburt
alisterburt / figure-it-out.ipynb
Created August 8, 2022 14:58
ribosome tilt-series simulation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alisterburt
alisterburt / extract_data.py
Created July 26, 2022 14:32
3DVA analysis
import os
import numpy as np
import pandas as pd
import mrcfile
from pathlib import Path
def components_from_cryosparc(cs_file):
data = np.load(cs_file)
@alisterburt
alisterburt / read_cif.py
Created July 17, 2022 19:14
Read PDB/mmCIF coords using gemmi
import gemmi
import numpy as np
pdb = '4v6x-ribo.cif'
structure = gemmi.read_structure(pdb)
model = structure[0] # assumes one model in the file
ca_coords = np.array([
[cra.atom.pos.x, cra.atom.pos.y, cra.atom.pos.z]