Skip to content

Instantly share code, notes, and snippets.

@mattdesl
mattdesl / model.py
Created November 2, 2023 20:29
fork of latent consistency model with a couple small perf tweaks
import os
import torch
import time
from diffusers import DiffusionPipeline, AutoencoderTiny
from collections import namedtuple
PredictionResult = namedtuple('PredictionResult', [
'latents',
'step',
'steps',
@RandyGaul
RandyGaul / routine.h
Last active November 6, 2022 15:33
Portable "coroutine"-like thing for implementing FSM and behavior-cycles
#ifndef ROUTINE_H
#define ROUTINE_H
#include <stdint.h>
// A portable "coroutine"-like thing for implementing FSM and behavior-cycles.
//
// Original implementation by Noel Berry.
// See: https://gist.github.com/NoelFB/7a5fa66fc29dd7ed1c11042c30f1b00e
//
@AjkayAlan
AjkayAlan / WSLWindows10Setup.md
Last active April 29, 2024 15:43
Windows SubSystem For Linux setup that I like with some developers stuff mixed in

Setting Up WSL

Install A Distro:

  1. Run the following in powershell as admin Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

  2. Install a distro (ex: Ubuntu 18.04 LTS - https://www.microsoft.com/store/apps/9N9TNGVNDL3Q)

  3. Open your distro you installed via the start menu, let it setup

  4. Update and upgrade

sudo apt-get update
@bodil
bodil / tween.ts
Created May 27, 2014 16:29
Tween.js + Bacon.js === <3
///<reference path="dts/tween.js.d.ts" />
///<amd-dependency path="tween" />
import b = require("./bacon");
import graph = require("./graph");
import ev = require("./events");
module TweenEffects {
var Tween = require("tween.js").Tween;
@pixelhandler
pixelhandler / transforms.js
Last active October 3, 2016 06:54
Raw object and array tranforms for Ember Data
/*
DS.attr('object')
*/
App.ObjectTransform = DS.Transform.extend({
deserialize: function(value) {
if (!$.isPlainObject(value)) {
return {};
} else {
return value;
}
@noahhendrix
noahhendrix / api.rb
Created December 22, 2011 09:38
Authenticating with Grape
module Todo
class API < Grape::API
use Rack::Session::Cookie
version 'v1', :format => :json
helpers do
def current_user
return nil if env['rack.session'][:user_id].nil?
@current_user ||= User.get(env['rack.session'][:user_id])
end