Navigation Menu

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
@atopuzov
atopuzov / covid19booster.healthservice.ie
Created January 6, 2022 14:11
DIG covid19booster.healthservice.ie
$ dig @89.101.160.4 covid19booster.healthservice.ie
; <<>> DiG 9.10.6 <<>> @89.101.160.4 covid19booster.healthservice.ie
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 38445
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
@atopuzov
atopuzov / gist:fb6f9de0a6a843a466f3
Last active July 6, 2021 14:47
Trees, trees everywhere ...
#!/usr/bin/env python
# (c) Aleksandar Topuzovic <aleksandar.topuzovic@gmail.com>
from functools import partial
from collections import deque
class node(object):
'''Simple nodee'''
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
@atopuzov
atopuzov / amphetamine.md
Created September 12, 2016 20:24 — forked from heptal/amphetamine.md
Hammerspoon replacement for Caffeine

Amphetamine

Simple toggleable menubar replacement for Caffeine in Hammerspoon, utilizing ASCIImage (for vector) to create the amphetamine icons. Motivated by the official Caffeine app's icon looking bad on Retina

Get latest version here: amphetamine.lua

Save as amphetamine.lua in ~/.hammerspoon/ and put amphetamine = require "amphetamine" in your init.lua

@atopuzov
atopuzov / r.hs
Last active June 28, 2019 06:41
{-# LANGUAGE DeriveFunctor #-}
newtype Fix f = Fix { unFix :: f (Fix f)}
data IntListF a =
Cons Int a
| Nil
deriving Functor
type IntList = Fix IntListF
@atopuzov
atopuzov / build-coreboot-for-chromebook-c201.md
Created May 14, 2019 15:29 — forked from markwylde/build-coreboot-for-chromebook-c201.md
Build Coreboot for ARM Chromebook - C201 Veyron Speedy

These instructions will take you through the step by step process of building and flashing a custom build of the Coreboot ROM to a Chromebook C201.

This guide expects you to have a Chromebook C201, and another ARM computer with Ubuntu installed. Specifically I used the Odroid XU2. You may be able to do this on an Intel platform, using a cross compiler. See the sidenotes section for more information.

Setting up your Ubuntu

Install dependancies

Update your Ubuntu aptitude and install the dependancies we will need.

sudo apt update
{-# LANGUAGE FlexibleContexts #-}
import Control.Monad.Writer (MonadWriter, Writer, tell, runWriter, runWriterT)
import Data.Functor.Identity (Identity, runIdentity)
import Data.Monoid (mempty)
-- manual threading of log
logSum :: [(Int, Int)] -> Int -> Int -> (Int, [(Int, Int)])
logSum log x y = (result, newlog)
where
{-# 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