Skip to content

Instantly share code, notes, and snippets.

@ilyakooo0
ilyakooo0 / haddock2latex.hs
Last active May 15, 2019 00:40
Very rough draft of a Pandoc filter for docs
#!/usr/bin/env stack
-- stack --resolver lts-13.21 --install-ghc runghc --package pandoc --package pandoc-types
{-# OPTIONS_GHC -Wall #-}
import Text.Pandoc
import Text.Pandoc.JSON
import Data.Foldable
import Debug.Trace
@ilyakooo0
ilyakooo0 / turingTester.swift
Created January 20, 2018 19:55
iko.soy/diskra/DZ2
import Foundation
#if os(Linux)
import SwiftGlibc
SwiftGlibc.srandom(UInt32(time(nil)))
public func arc4random_uniform(_ max: UInt32) -> Int32 {
return (SwiftGlibc.rand() % Int32(max-1))
}
@ilyakooo0
ilyakooo0 / turingSolver.swift
Created January 20, 2018 19:53
iko.soy/diskra/DZ2
import Foundation
#if os(Linux)
import SwiftGlibc
SwiftGlibc.srandom(UInt32(time(nil)))
public func arc4random_uniform(_ max: UInt32) -> Int32 {
return (SwiftGlibc.rand() % Int32(max-1))
}
#endif
@ilyakooo0
ilyakooo0 / turing2Post.swift
Created January 20, 2018 19:39
iko.soy/diskra/DZ2
import Foundation
#if os(Linux)
import SwiftGlibc
SwiftGlibc.srandom(UInt32(time(nil)))
public func arc4random_uniform(_ max: UInt32) -> Int32 {
return (SwiftGlibc.rand() % Int32(max-1))
}
#endif
import Data.List
import Control.Monad
most :: [Int] -> Int
most ns = let
fs :: [[Int]]
fs = group . sort . map (\n -> read [head . show $ n]) $ ns
foo acc nn = case (fst acc `compare` length nn, snd acc `compare` head nn) of
(GT, _) -> (length nn, head nn)