Skip to content

Instantly share code, notes, and snippets.

View mathiasose's full-sized avatar
💭
🤔

Mathias Ose mathiasose

💭
🤔
View GitHub Profile
@mathiasose
mathiasose / euler2.re
Last active July 31, 2018 13:25
Trying ReasonML
/*
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
*/
let rec evenFibSum = (max_value, prev_num, prev_prev_num, even_sum) => {
let new_num = prev_num + prev_prev_num;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am mathiasose on github.
  • I am ose (https://keybase.io/ose) on keybase.
  • I have a public key ASAyK9-a9Hh_xc25ENALVj2c0cTyuoR4KjvmUgd68rGtjgo

To claim this, I am signing this object:

@mathiasose
mathiasose / bootstrap_linux.sh
Last active December 8, 2017 08:47
The bare necessities
sudo apt install curl vim git tree tmux -y
wget https://gist.githubusercontent.com/mathiasose/f11a441a2d38b54fd454a9add2b6f411/raw/.profile --output-document ~/.profile
wget https://gist.githubusercontent.com/mathiasose/8974768/raw/.bashrc --output-document ~/.bashrc
wget https://gist.githubusercontent.com/mathiasose/0dcac3cb1dcb1d93e193c2e7b698460a/raw/.zshrc --output-document ~/.zshrc
wget https://gist.githubusercontent.com/mathiasose/8974766/raw/.vimrc --output-document ~/.vimrc
//
// How to access GPIO registers from C-code on the Raspberry-Pi
// Example program
// 15-January-2012
// Dom and Gert
// Revised: 15-Feb-2013
// Access from ARM Running Linux
#!/usr/bin/python3.4
from picamera import PiCamera
from sys import stdout
RES = (640, 480)
FPS = 30
STREAM = stdout.buffer
<!DOCTYPE html>
<html lang="nb">
<head>
<title>Hackerspace NTNU</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootswatch/3.3.2/yeti/bootstrap.min.css"/>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
</head>
import os
dir = '~/'
files = list(os.walk(dir))[0][2]
cr2s = sorted(list(filter(lambda x: 'CR2' in x, files)))
for f in cr2s:
cr2 = os.path.join(dir, f)
@mathiasose
mathiasose / HTMLStrippingMinLengthValidator
Last active August 29, 2015 14:10
Django MinLengthValidator that ignores HTML tags when counting characters
from html.parser import HTMLParser
from django.core.validators import MinLengthValidator
# via http://stackoverflow.com/a/925630/2295891 (see there for Py2 version)
class MLStripper(HTMLParser):
def __init__(self):
super(MLStripper, self).__init__()
self.reset()