Skip to content

Instantly share code, notes, and snippets.

@Icelandjack
Icelandjack / OpenKinds.markdown
Last active January 26, 2020 20:53
Rethinking Tricky Classes: Explicit Witnesses of Monoid Actions, Semigroup / Monoid / Applicative homomorphisms
@CRTified
CRTified / xmonad.hs
Created October 1, 2017 18:15
ACPI logger
-- Define acpi power logger
acpi_power :: String -> [String] -> Logger
acpi_power dev attr =
io $ do
attrOut <- mapM (\x -> liftIO $ readFile $ sysFsPath ++ x) attr
return $ Just $ filter (/= '\n') (intercalate " " attrOut)
where
sysFsPath = "/sys/class/power_supply/" ++ dev ++ "/"
file_reader :: String -> Logger
#!/usr/bin/env python
import time
"""
Utility Functions and decorators for internal use
"""
def timeit(method):
def timed(*args, **kw):
ts = time.time()
@Sebbyastian
Sebbyastian / ack.c
Last active April 4, 2022 21:23
Ackermann function in recursive and non-recursive form
#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
int ack_recursive(int m, int n) {
if (m == 0) {
return n + 1;
}