Skip to content

Instantly share code, notes, and snippets.

____________
< beavis.zen >
------------
\ __------~~-,
\ ,' ,
/ \
/ :
| '
| |
| |
@wizzup
wizzup / docker.service
Last active November 9, 2016 01:53
Fix docker cause other program unresponsive by moving docker.service out-of system.slice
## /etc/systemd/system/docker.service
.include /usr/lib/systemd/system/docker.service
[Service]
Slice=limit.slice
@wizzup
wizzup / test.hs
Created January 16, 2017 13:53
diagrams testing
import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine
import Control.Monad
points :: [P2 Double]
points = map (\[a,b] -> p2 (a,b)) $ replicateM 2 ([1,10..100] :: [Double])
myC :: Int -> Diagram B
myC r = square (fromIntegral r) #lc color #lw 3
where color = case r `mod` 3 of
@wizzup
wizzup / GenericPath.hs
Last active June 17, 2017 10:08 — forked from flickyfrans/Generic path
The shortest path in a graph
import Control.Monad
import Control.Monad.Trans.State
import Data.Maybe
(<.>) :: Monad m => (a -> b) -> (c -> m a) -> c -> m b
f <.> g = fmap f . g
whenJust :: Monad m => Maybe t -> (t -> m ()) -> m ()
whenJust Nothing _ = return ()
whenJust (Just x) f = f x
@wizzup
wizzup / a.hs
Last active June 17, 2017 10:18
Irrefutable patterns
import Data.Maybe
data Rose a = Rose a [Rose a] deriving Show
newtype Graph a = Graph [(a, Rose a)]
lookupRose :: Eq a => a -> Graph a -> Rose a
lookupRose i (Graph rs) = fromJust $ lookup i rs
fromList :: Eq a => [(a, [a])] -> Graph a
fromList xs = graph where
@wizzup
wizzup / LilLambda.ipynb
Created September 11, 2017 10:24 — forked from vakila/LilLambda.ipynb
Anjana Vakil, "Mary had a little lambda", EuroPython 2017: https://ep2017.europython.eu/conference/talks/mary-had-a-little-lambda
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wizzup
wizzup / Makefile.am
Last active April 4, 2019 10:36
Hello world in C with GNU autotools
# สร้าง binary ชื่อ hello
bin_PROGRAMS = hello
# สร้าง hello จาก main.c
hello_SOURCES = main.c
@wizzup
wizzup / .gitignore
Last active September 13, 2019 04:28
capt-debug-log
We couldn’t find that file to show.