Skip to content

Instantly share code, notes, and snippets.

@iimanu
iimanu / stablediffusionwalk.py
Created August 16, 2022 07:14 — forked from karpathy/stablediffusionwalk.py
hacky stablediffusion code for generating videos
"""
draws many samples from a diffusion model by slerp'ing around
the noise space, and dumps frames to a directory. You can then
stitch up the frames with e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i out/frame%04d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p test.mp4
THIS FILE IS HACKY AND NOT CONFIGURABLE READ THE CODE, MAKE EDITS TO PATHS AND SETTINGS YOU LIKE
THIS FILE IS HACKY AND NOT CONFIGURABLE READ THE CODE, MAKE EDITS TO PATHS AND SETTINGS YOU LIKE
THIS FILE IS HACKY AND NOT CONFIGURABLE READ THE CODE, MAKE EDITS TO PATHS AND SETTINGS YOU LIKE
@iimanu
iimanu / avl_tree.py
Created March 13, 2020 17:22 — forked from Twoody/avl_tree.py
AVL tree implementation in python
#import random, math
outputdebug = False
def debug(msg):
if outputdebug:
print (msg)
class Node():
def __init__(self, key):
@iimanu
iimanu / test_utilities.h
Created January 26, 2019 10:52 — forked from eladn/test_utilities.h
C tests utilities
#ifndef TEST_UTILITIES_H_
#define TEST_UTILITIES_H_
#include <stdbool.h>
#include <stdio.h>
#include <assert.h>
#ifndef min
#define min(a,b) ((a)<(b) ? (a) : (b))
#endif /* min */
@iimanu
iimanu / bitfield_accessor.c
Created January 26, 2019 10:52 — forked from eladn/bitfield_accessor.c
C macros for declaring and accessing bit fields (takes care for the shift and mask manipulations).
// Helper macros for creating Offsets struct
// (that are used later by the bitfield accessors).
# define maskForField(name) (((uint64_t(1)<<name##BitCount)-1) << name##Shift)
# define shiftAfterField(name) (name##Shift + name##BitCount)
// "Bitfield" accessors.
# define getFieldIn(bits, offsets, name) \
((bits & offsets::name##Mask) >> offsets::name##Shift)
# define setFieldIn(bits, offsets, name, val) \
bits = ((bits & ~offsets::name##Mask) | \
@iimanu
iimanu / heapdict.py
Created January 26, 2019 10:51 — forked from eladn/heapdict.py
Python priority queue, inherits from collections.MutableMapping, and allows adding and removing items.
import collections
"""
This is based on HeapDict 1.0.0, but includes a few modifications.
https://pypi.org/project/HeapDict/
"""
def doc(s):
if hasattr(s, '__call__'):
s = s.__doc__
@iimanu
iimanu / fourier.html
Created March 31, 2017 16:28 — forked from kazad/fourier.html
BetterExplained Fourier Example
<html>
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.2/underscore-min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
<script src="//ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
<!--
TODO:
@iimanu
iimanu / List.cpp
Created December 30, 2016 21:33 — forked from kaaveland/List.cpp
Linked list
#include "List.h"
#include <iostream>
#include <string>
/**********************
* ListLink
*
**********************
*/