Skip to content

Instantly share code, notes, and snippets.

View tippenein's full-sized avatar

Brady Ouren tippenein

  • Los Angeles, CA
  • 22:44 (UTC -07:00)
View GitHub Profile
@tippenein
tippenein / lsystem.hs
Created September 3, 2023 18:12
LSystem with openGL
-- | some packages i needed to install to get opengl working
-- sudo apt-get install mesa-utils libglu1-mesa-dev freeglut3-dev mesa-common-dev
-- libglew-dev libglfw3-dev libglm-dev
-- libao-dev libmpg123-dev xlibmesa-glu-dev
import Util
import qualified Data.Text as T
import qualified Graphics.Gloss as G
import Graphics.Gloss
import Data.Traversable
#!/usr/bin/env python3
# go from a csv of nested data to a bunch of sql insert statements
from csv import reader
from uuid import uuid4
file_name = "category.csv"
def do():
collections = {}
@tippenein
tippenein / Swarm.hs
Created September 21, 2021 04:01
PSO
module Swarm where
-- | Particle Swarm Optimization
--
-- Goals
-- 1. optimize with a Particle Swarm to find some optimal goal within a decently complex function
-- 2. attempt to parallelize each particle trajectory
-- 3. visualize
import Data.Maybe
-- File auto generated by purescript-bridge! --
module App.Crud where
import Data.Lens (Lens', Prism', lens, prism')
import Data.Lens.Iso.Newtype (_Newtype)
import Data.Lens.Record (prop)
import Data.Maybe (Maybe, Maybe(..))
import Data.Newtype (class Newtype)
import Data.Symbol (SProxy(..))
machine:
services:
- postgresql
database:
override:
- createuser -s -d test
- createdb rsvptest
dependencies:
-- like this?
import Language.PureScript.Bridge.PSTypes (psInt)
int64Bridge :: BridgePart
int64Bridge = typeName ^== "Int64" >> return psInt
mainBridge = defaultBridge <|> int64Bridge
@tippenein
tippenein / t.hs
Created September 12, 2017 16:13
using withServantServer tets generation
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE KindSignatures #-}
module Main
( main
) where
@tippenein
tippenein / flash.purs
Created August 31, 2017 04:46
a simple flashMessage function for web app notifications
import Control.Monad.Eff.JQuery as Q
import Prelude hiding (div)
import Control.Monad.Eff
import Control.Monad.Eff.Timer (TIMER)
data Message
= Success
| Failure
| Info
@tippenein
tippenein / naive_amortization.rb
Created January 24, 2017 00:55
naive amortization
# naive amortization implementation using enumerators.
# used for a possible answer to compare against candidate solutions
# intended to determine how a candidate breaks up a problem
# similar haskell implementation - https://gist.github.com/tippenein/8dceb2d50272ec24ce13fe83f3a57bfa
module Amortizable
include Enumerable
@tippenein
tippenein / file_hash.hs
Created October 7, 2016 18:47
sha256 hash file(s) from command line
#!/usr/bin/env runhaskell
import Crypto.Hash
import Data.ByteString
import Prelude hiding (readFile)
import System.Environment (getArgs)
keyFor :: FilePath -> IO ()
keyFor filepath = do
bytes <- readFile filepath