Skip to content

Instantly share code, notes, and snippets.

@bebeal
bebeal / blender_template
Created September 20, 2025 09:35
template starting code for llms to generate python blender
import bpy
import math
import bmesh
# Always follow these rules
# - for every object you create, create it at the origin, size it, then move it if applicable
# - always center things (w.r.t the proper axis) when stacking/arranging them
# - everythign should be modular and easy to tweak
# - put parameters in constants at the top of the file but dont define a fuck ton of conflicting inter-dependant constants just the minimum ones which control the sizing
@bebeal
bebeal / top1.ipynb
Created August 15, 2025 17:09
UpConvs for Image Generation ~ Image Compression via Neural Net - YouGotBeatByASigmoid solution (10/07/2021)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bebeal
bebeal / hqgif.sh
Last active July 28, 2025 17:15
hqgif: High quality (50fps) gif tool
#!/bin/bash
# curl -o /usr/local/bin/hqgif https://gist.github.com/bebeal/6fe1ad8c72f0e560780e080188ff28f7/raw/hqgif.sh
# chmod +x /usr/local/bin/hqgif
# hqgif input.mov [output.gif]
#
# Converts video files to high-quality GIFs using a two-pass process:
# 1. Generates an optimized color palette from the source video
# 2. Creates the GIF using the custom palette for better quality
#
@bebeal
bebeal / ThemeToggle.tsx
Last active June 23, 2025 18:54
toggle jiggle physics
import { AsleepFilled, LightFilled } from '@carbon/icons-react';
import { useTheme } from 'next-themes';
import { useCallback, useEffect, useState } from 'react';
const getBoxShadow = (theme?: string, resolvedTheme?: string) => {
const isLight = resolvedTheme === 'light';
const baseColor = resolvedTheme !== 'light' ? '#0d1117' : 'white';
const thumbLeft = `calc(1rem * -1) 0 0 2px ${baseColor} inset, 0 0 0 2px ${baseColor} inset`;
const thumbMiddle = `calc(1rem / 2) 0 0 2px ${baseColor} inset, calc(1rem / -2) 0 0 2px ${baseColor} inset, 0 0 0 2px ${baseColor} inset`;
@bebeal
bebeal / to-mp4.sh
Last active June 5, 2025 06:44
batch converts all common video files in a directory to .mp4 format using ffmpeg
#!/bin/bash
# to-mp4: batch converts all common video files in a directory to .mp4 format using ffmpeg
#
# Usage:
# convert_all_videos <directory> [--delete]
#
# Arguments:
# <directory> Path to the folder containing video files to convert
# --delete Optional flag to delete original files after successful conversion
@bebeal
bebeal / Optic Bobbin Generator Blender
Created May 25, 2025 18:21
Generates simple blender geometries for fiber optic bobbins
import bpy
# Clear existing mesh objects
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=False)
# Bobbin dimensions (all measurements in mm)
components = [
{ # Outlet nozzle
"name": "Nozzle",
@bebeal
bebeal / Ripple flash ui effect for clickables
Last active May 25, 2025 18:20
Ripple flash ui effect for clickables
const onClick = useCallback((event: any) => {
createRippleEffect(event);
};
@bebeal
bebeal / codeLanguages
Created May 7, 2025 04:39
icons & types for code languages
import React, { forwardRef } from 'react';
export const codeLanguages = [
'bash',
'c',
'cpp',
'c#',
'objective-c',
'css',
'go',
@bebeal
bebeal / combine_katex.ts
Created May 2, 2025 05:23
vite plugin to combine katex files cause they have a billion
// Create plugin to combine KaTeX fonts
function combineKatexFonts(): Plugin {
return {
name: 'combine-katex-fonts',
enforce: 'post',
apply: 'build',
generateBundle(_, bundle) {
// Find all KaTeX font files in the bundle
const fontFiles = Object.keys(bundle).filter(fileName =>
@bebeal
bebeal / DDQN.py
Created November 25, 2024 08:20
old rl code
import os, math
import random
import gym
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from gym import spaces
import cv2
from collections import deque