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
--- 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($
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="
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. 
#!/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):
#!/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
# 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):

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@atopuzov
atopuzov / asus c201.md
Created September 1, 2016 14:08 — forked from jcs/asus c201.md
Disabling SPI write protection, reflashing, and unbricking an Asus Chromebook C201

####Disabling SPI write protection

Put the Chromebook in developer-mode:

  • With machine powered off, hold down Esc and Refresh(F3) while hitting power button
  • At warning prompt, hit Control+D, then Enter at prompt about enabling developer mode
  • Machine will format itself

Now remove the write-protect screw to enable flashrom to flash new Coreboot/Libreboot.

Flip powered-off machine over and remove 8 philips-head screws. 2 are located under rubber feet.

#!/bin/sh
. /lib/functions/network.sh
network_find_wan wan_if
network_get_device wan_if_dev $wan_if
if ! ping -I $wan_if_dev -q -c 1 -W 10 8.8.8.8 > /dev/null
then
echo "Lost internet connectivity. Reconnecting." | logger -t "tester[$$]" -p info
(ifup $wan_if)
@atopuzov
atopuzov / beautiful_idiomatic_python.md
Created November 18, 2015 17:41 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]: