Skip to content

Instantly share code, notes, and snippets.

View Rembane's full-sized avatar
🔥

Andreas Ekeroot Rembane

🔥
View GitHub Profile
@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>
( 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 / 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
@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 / 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 / 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.'
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 / 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)
#include <stdio.h>
int main() {
unsigned long longest = 0;
unsigned long longest_collatz = 0;
unsigned long i = 2;
unsigned long collatz, length;
for(; i < 1000000; i++) {
collatz = i;
length = 0;
@Rembane
Rembane / one_ring_to_rule_them_all.py
Created March 6, 2013 23:05
Ugliest script ever to remove the BOM from all Python files! :D
#!/usr/bin/env python
import os
for (path, dirs, files) in os.walk(os.getcwd()):
for f in [os.path.join(path, f) for f in files if f.endswith('.py')]:
fh_in = open(f)
if '\xEF\xBB\xBF' in fh_in.read(10):
fh_in.seek(0)
s = fh_in.read().replace('\xEF\xBB\xBF', '')