Skip to content

Instantly share code, notes, and snippets.

View dmalikov's full-sized avatar
🥞
!

Dmitry Malikov dmalikov

🥞
!
View GitHub Profile
@copumpkin
copumpkin / Mat.agda
Last active August 29, 2015 13:56
"Simple" matrix math for Agda
module Mat where
open import Function
open import Data.Empty
open import Data.Nat using (ℕ; zero; suc)
open import Data.Fin using (Fin; zero; suc; toℕ)
open import Data.Fin.Props using ()
open import Data.Product
open import Relation.Nullary
open import Relation.Binary
@supki
supki / eblo.hs
Last active August 29, 2015 14:01
Crap
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
-- Idris translation of copumpkin's Agda code:
-- https://gist.github.com/copumpkin/8758586
-- Proves that List reverse is completely specified by:
-- 1. f [] = []
-- 2. f [x] = [x]
-- 3. f (xs ++ ys) = f ys ++ f xs
reverse' : List a -> List a
reverse' [] = []
@ikedaisuke
ikedaisuke / gist:883394
Created March 23, 2011 16:28
reverse (reverse xs) ≡ xs in Coq
Require Import Coq.Lists.List.
Lemma rev_Unfold : forall {A:Type} (l:list A) (a:A), rev (a::l) = rev l ++ (cons a nil).
Proof.
intros.
simpl.
reflexivity.
Qed.
Theorem rev_Involutive : forall {A:Type} (l:list A), rev (rev l) = l.
@copumpkin
copumpkin / State.agda
Last active October 4, 2015 15:18
The State monad
module Categories.Agda.State where
open import Categories.Category
open import Categories.Agda
open import Categories.Agda.Product
open import Categories.Functor hiding (_≡_)
open import Categories.Functor.Product
open import Categories.Functor.Hom
open import Categories.Monad
open import Categories.Adjunction
@supki
supki / hackage-authors.pl
Created June 26, 2012 20:26
Silly stuff to get hackage authors sorted by productivity.
#!/usr/bin/env perl
# This crappy perl script parses .cabal files for `authors' field and extracts authors names. Then it collects them in one enormous hash associating total number of findings. Then it "pretty"-prints hash from most productive authors to least productive.
use v5.14;
use warnings FATAL => qw(void);
# Skip all lines before /^author:/i one, then return it.
sub lex ($) {
my $h = $_[0];
while (<$h>) { if (/^author:/i) { return $_ } }
@proger
proger / Makefile
Last active October 8, 2015 22:18
private nix stores
helper = /tmp/.build-secrets-helper
# path to the ephemeral store
store = /run/sproxy-sink/store
aes_path = secrets/aes-password
gpg_key = C4DECDD2
secrets-encrypted: paths-sproxy.nix $(aes_path)
tar c $(store) | openssl aes-256-cbc -pass file:secrets/aes-password -a > $@
paths-sproxy.nix: ./sproxy-config.nix
@supki
supki / udmurt.hs
Created October 16, 2012 13:08
UDMURTI SILA
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE UnicodeSyntax #-}
import Data.Colour
import Diagrams.Prelude
import Diagrams.Backend.Cairo.CmdLine
import Graphics.Rendering.Diagrams.Points
main ∷ IO ()
@TheEvilDev
TheEvilDev / Dependency.rb
Created November 27, 2012 00:31
Albacore improved nuspec generating, auto-dependency discovery
class Dependency
attr_accessor :Name, :Version
def initialize(name, version)
@Name = name
@Version = version
end
end
@voidlizard
voidlizard / static-linked-ghc
Created December 3, 2012 12:53
Fully statically linked haskell application
ghc -i -static -optl-static -optl-pthread -funbox-strict-fields -fwarn-incomplete-patterns -isrc --make Program.hs