Skip to content

Instantly share code, notes, and snippets.

View Rembane's full-sized avatar
🔥

Andreas Ekeroot Rembane

🔥
View GitHub Profile
@Rembane
Rembane / automaton.hs
Created April 18, 2013 07:12
Just some scribblings. Carry on. :)
import qualified Data.Set as S
type State = String
type Letter = String
type Alphabet = S.Set Letter
{-
data Automaton = Automaton { auto_state :: S.Set State
, auto_alphabet :: Alphabet
, auto_delta :: (State -> Letter -> State)
Hej!
Som en trevlig present så här i början på det nya året kommer kallelsen till Sverok Nedre Norrlands Årsmöte. Just du får det här brevet för att du varit medlem i en Sverok-förening med säte i Nedre Norrland (Jämtland och Västernorrland) under 2006/2007.
Årsmöte
Sverok Nedre Norrland har årsmöte den 7:e till 9:e mars. I år kommer vi att använda Själevads Fritidsgård som möteslokal.
Mer information om årsmötet kommer på hemsidan efter helgen, men använd gärna forumet redan nu om det är något du undrar.
http://nn.sverok.se/
@Rembane
Rembane / poke_gunicorn.py
Created June 18, 2013 09:43
The script makes gunicorn restart all the workers.
#!/usr/bin/env python
# Sends HUP to the parent Gunicorn
import subprocess
for row in subprocess.check_output('ps axo ppid,pid,comm | grep gunicorn', shell=True).splitlines():
parts = row.strip().split()
if parts[0] == '1': # Parent
subprocess.call(['kill', '-HUP', parts[1]])
print 'gunicorn is now reloading your code.'
@Rembane
Rembane / logging.hs
Created August 17, 2013 18:18
A small example that shows logging to file and stderr in Haskell.
module Main where
import System.Log.Logger
import System.Log.Handler.Simple
import System.Log.Handler (setFormatter)
import System.Log.Formatter
main = do
-- Initialize loggers
@Rembane
Rembane / .vimrc
Last active December 21, 2015 10:29
My Vim config
" Inget pip goddamit!
set visualbell
syntax on
set autoindent
set nosmartindent
set tabstop=4
set expandtab
set shiftwidth=4
set hlsearch " Higliht searched words
@Rembane
Rembane / fizzbuzz.hs
Last active December 21, 2015 16:49
The typed solution for FizzBuzz.
module Main where
data FzBz = Fizz | Buzz | FizzBuzz | N Int
instance Show FzBz where
show Fizz = "Fizz"
show Buzz = "Buzz"
show FizzBuzz = "FizzBuzz"
show (N x) = show x
( 33/185) upgrading firefox [#######################################################] 100%
New optional dependencies for firefox
gstreamer0.10-bad-plugins: aac, vp8 and opus decoding [installed]
gstreamer0.10-base-plugins: vorbis decoding, ogg demuxing [installed]
gstreamer0.10-good-plugins: webm and mp4 demuxing [installed]
gstreamer0.10-ugly-plugins: h.264 decoding
@Rembane
Rembane / index.html
Created October 19, 2013 22:57
A Haste example!
<!DOCTYPE html>
<html>
<body>
<h1>My web page</h1>
This document has a heading and some text. <em>This sentence is emphasized.</em>
<script src="main.js" type="text/javascript"></script>
</body>
</html>
@Rembane
Rembane / this_is_usable_code.py
Last active December 26, 2015 06:39
This is a tree which contains prefixes of names.
# Lets build a dictionary of people, like this:
names = [u'{} {}'.format(f.lower(),e.lower()) for (f,e) in Participant.objects.values_list('fname', 'ename').order_by('fname', 'ename')]
autocompletion_tree = defaultdict(list)
for (i,n) in enumerate(names):
s = ''
for c in n:
s += c
autocompletion_tree[s].append(i)
# Purge it!
O
-|-
|||
|||
-
|||
| |
- -
http://www.youtube.com/watch?v=vTnSf8OjYQ0