Skip to content

Instantly share code, notes, and snippets.

View atopuzov's full-sized avatar
😎
Haskell, nix, functional programming

Aleksandar Topuzović atopuzov

😎
Haskell, nix, functional programming
View GitHub Profile
#!/usr/bin/env python
# Aleksandar Topuzovic <aleksandar dot topuzovic at gmail dot com>
import re
rect_regex = re.compile("rect (?P<n>\d+)x(?P<m>\d+)")
rotate_regex = re.compile("rotate (?P<what>column|row) (x|y)=(?P<cid>\d+) by (?P<by>\d+)")
class Cmd(object):
#!/usr/bin/env python
import re
value_regex = re.compile("value (?P<value>\d+) goes to bot (?P<dest>\d+)")
gives_regex = re.compile("bot (?P<bot>\d+) gives low to (?P<low_dest>(output|bot)) (?P<low_id>\d+) and high to (?P<high_dest>(output|bot)) (?P<high_id>\d+)")
class Element(object):
def store(self):
raise NotImplemented('Need to override this.')
#!/usr/bin/env python
import re
cpy_regex = re.compile(r"cpy ((?P<reg>[a-z]+)|(?P<num>\d+)) (?P<y>\w+)")
inc_regex = re.compile(r"inc (?P<x>\w+)")
dec_regex = re.compile(r"dec (?P<x>\w+)")
jnz_regex = re.compile(r"jnz ((?P<reg>[a-z]+)|(?P<num>\d+)) (?P<y>[\w-]+)")
class Cmd(object):
Starting Google_Veyron_Speedy firmware updater v5 (recovery)... 
 - Updater package: [Google_Veyron_Speedy.6588.197.0 / EC:speedy_v1.1.2712-242f6bd] 
 - Current system:  [RO:libreboot-r20160907 , ACT:libreboot-r20160907 / EC:speedy_v1.1.2697-faafaa5] 
 - Write protection: Hardware: off, Software: Main=ON EC=ON 
 
  Sorry, this firmware update is only for Google_Veyron_Speedy platform. 
  Your system (libreboot-r20160907) is either incompatible or using an 
 unknown version of firmware. 
export ARCH=arm
export CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi-
export KERNEL_SERIES=v4.13
export KERNEL_BRANCH=v4.13-rc1
export LOCALVERSION=
export MALI_VERSION=r19p0-01rel0
export MALI_BASE_URL=https://developer.arm.com/-/media/Files/downloads/mali-drivers/kernel/mali-midgard-gpu
export DTB_FILES="
--- before.yaml^I2017-09-29 11:44:09.000000000 +0100$
+++ now.yaml^I2017-09-29 12:18:11.000000000 +0100$
@@ -13,7 +13,7 @@$
data:$
kube-api.rules: |-$
# NOTE: These rules were kindly contributed by the SoundCloud engineering team.$
-$
+ $
ALERT K8SApiServerLatency$
IF histogram_quantile($
{-# LANGUAGE FlexibleContexts #-}
-- FelixbleContexts required for MonadReader
-- Based on https://blog.ssanj.net/posts/2014-09-23-A-Simple-Reader-Monad-Example.html
import Control.Monad.Reader (ask, runReader, MonadReader, Reader)
import Control.Applicative ((<*>))
import Control.Monad ((>>=))
-- Environment type
type MyEnv = String
{-# LANGUAGE FlexibleContexts #-}
-- FelixbleContexts required for MonadReader, MonadIO
-- Based on https://hackernoon.com/the-reader-monad-part-1-1e4d947983a8
import Control.Monad.Reader (MonadReader, ReaderT, ask, runReaderT)
import Control.Monad.IO.Class (MonadIO, liftIO)
-- Need 2 files in the current directory
-- test.txt (read by the load function)
-- history5.txt (read by the loadRevsion function)
{-# LANGUAGE FlexibleContexts #-}
-- FelixbleContexts required for MonadState
import Control.Monad.State (MonadState, State, get, put, runStateT, evalStateT, execStateT)
import Data.Functor.Identity (Identity, runIdentity)
-- Threading the state trough functions and returning vale and state product
inc1 :: Int -> (Int, Int)
inc1 state = (value, newState)
where