Skip to content

Instantly share code, notes, and snippets.

View supki's full-sized avatar
🇦🇲
🤝 🏳️‍🌈

Matvey Aksenov supki

🇦🇲
🤝 🏳️‍🌈
  • Gorgoroth, Mordor
View GitHub Profile
maksenov@supki-laptop:~/playground/tar% time ./Main > /dev/null
./Main > /dev/null 0.16s user 0.09s system 99% cpu 0.250 total
maksenov@supki-laptop:~/playground/tar% time ./a.out > /dev/null
./a.out > /dev/null 0.01s user 0.03s system 98% cpu 0.037 total
@supki
supki / eblo.hs
Created September 28, 2013 08:49
M
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverlappingInstances #-}
module Just where
class Just a b where
collapse :: Maybe a -> Maybe b
instance Just a a where
collapse = id
@supki
supki / M.hs
Created August 23, 2013 16:07
PEMKA
{-# OPTIONS_GHC -W #-}
module Format where
import Control.Applicative (Applicative(..), Alternative(..), liftA2)
import Data.Foldable (asum)
import Data.Semigroup
infixr 4 :+:
-- | AST for formats:
@supki
supki / Mip.hs
Created August 21, 2013 13:52
M
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -W #-}
module Mip where
import Control.Applicative (Applicative(..))
import qualified Control.Lens as L
import Control.Lens.Operators
@supki
supki / pemis.log
Last active December 20, 2015 20:38
M
maksenov@supki-laptop:~/git/biegunka% g log -10 --oneline origin/develop
dbdec92 7.6.2 (?) bug fix.
1b096de Rewrite 'check' interpreter.
4aa1c23 Add a bit of doctests.
89b1006 Fix specs.
504c900 Update biegunka init template
c9f230f Cleverer TH.
6a3e4de Remove Mode.
8001860 Work with directories as path for `biegunka init`.
c80072a Swap retries/reacting in docs.
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
class Function
attr_reader :block
def initialize &block
@block = block
end
#!/bin/bash -e
# $branch supposedly points to previous git branch
function git-checkout-back ()
{
git checkout "${branch}"
}
echo -e "\n * Generating docs..\n"
@supki
supki / partial.hs
Last active December 18, 2015 22:18
M?
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}
module Partial where
import Control.Exception (PatternMatchFail, catch, evaluate)
import Data.Maybe (mapMaybe)
import System.IO.Unsafe (unsafePerformIO)
@supki
supki / increment.sh
Last active December 18, 2015 18:29
Increment first matched [number] in file using Vim
#!/bin/bash -e
# Try to increment first regex match in file
vimregex=$1
filename=$2
vim -es -u NONE \
-c "${vimregex}" \
 -c ':normal ' \
-c ':wq' "${filename}"
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
def f
s = gets.chomp
z = Class.new
z.class_eval do
define_method :ma do
s * 2