Skip to content

Instantly share code, notes, and snippets.

@IronGremlin
IronGremlin / steve_clean.hs
Last active September 29, 2017 22:03
steve_clean.hs
{-
steve_clean () {
toplost=$(for i in $(ls /fileserver/lost+found/); do echo "$(ls /fileserver/lost+found/$i | wc -l) : ${i}"; done | sort -h -r )
rmain=$(echo -E "$toplost" | wc -l)
for i in $(echo -E "$toplost" | cut -d':' -f2 | sed 's/ //'); do
echk=$(ls -la $i | wc -l)
if [[ $echk == 3 ]] ; then
echo "Empty path, removing $i"
rm -rf $i;
((rmain--));
@IronGremlin
IronGremlin / input_output.hs
Last active November 17, 2017 17:20
vscode Apply hint bug
module Derptastic where
someFunction :: IO ()
someFunction = readFile (".aFile") >>= putStrLn
otherFunction :: (Num t, Eq t) => t -> t -> t
otherFunction a b
| a == 5 = b
| otherwise = a
@IronGremlin
IronGremlin / DigitalPlumber.hs
Last active September 12, 2020 16:53
Attempt at recursion-schemes
import qualified Data.Set as S
import qualified Data.Map.Strict as M
import Data.List.Split (splitOn)
import Data.List (stripPrefix)
import Data.Maybe (fromJust)
newtype Fix f = In { out :: f (Fix f) }
type Algebra f a = f a -> a
@IronGremlin
IronGremlin / predicate_lang.rs
Created January 11, 2022 18:10
Rust predicate AST
type Input = ();
type Condtion = fn(Input) -> bool;
type Procedure = fn();
#[derive(Clone)]
enum AbstractBoolean {
And(Box<AbstractBoolean>, Box<AbstractBoolean>),
Or(Box<AbstractBoolean>, Box<AbstractBoolean>),
Par(Box<AbstractBoolean>),
Not(Box<AbstractBoolean>),
use std::time::Duration;
use bevy::prelude::*;
use crate::SimState;
#[derive(Resource)]
pub struct GameClock {
delta: Duration,
#[derive(Component)]
struct ScrollableElement {
mask: Entity,
content_container: Entity,
scroll_bar_element: Entity,
scroll_bar_handle: Entity,
scroll_value: f32,
}
impl ScrollableElement {