This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from buz import Buz, Inbox | |
buz = Buz() | |
# Sending a message asynchronously is ridiculously simple | |
def long_computation(self): | |
# looong slow algorithm (possibly involving polling I/O ports!) | |
buz.publish(SomeMessage(..)) | |
# Remember the hell we go through to do things in parallell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import unittest | |
# Unit tests for kata 'domevent' | |
''' Synchronous domain events in pure Python. | |
#- triggering an event | |
#- registering a callback | |
#- triggering an event with 1 handler | |
#- triggering an event with 2 handlers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:{var txt = prompt('Minddumpa vad?'); alert(txt); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
sudo sh -c 'echo "deb http://dl.google.com/linux/talkplugin/deb/ stable main" >> /etc/apt/sources.list.d/google.list' | |
sudo apt-get update | |
sudo apt-get install google-talkplugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rule 1. Carnivors and herbivors cannot live together. | |
# For example, moving a lion to an enclosement with a zebra is not good, since the zebra will be eaten. | |
zoo = Zoo() | |
zoo.add_fenced_enclosure('Fenced area 1') | |
zoo.add_fenced_enclosure('Fenced area 2') | |
zoo.add_carnivore('lion', 'Fenced area 1') | |
zoo.add_herbivore('zebra', 'Fenced area 2') | |
assertThrows(zoo.move_animal('lion', 'Fenced area 2')) | |
# Rule 2: Herbivors can live side-by-side. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> | |
<head> | |
<title>Start page</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<style type="text/css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Poor mans digital sign</title> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8" /> | |
<script> | |
var urls = [ | |
'http://www.bloggar.se', | |
'http://www.knuff.se', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get upgrade -y | |
sudo apt-get install adobe-flashplugin | |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4E9CFF4E | |
sudo sh -c 'echo "deb http://repository.spotify.com stable non-free" >> /etc/apt/sources.list' | |
sudo apt-get update && sudo apt-get install spotify-client-qt -y --force-yes | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4E9CFF4E | |
sudo sh -c 'echo "deb http://repository.spotify.com stable non-free" >> /etc/apt/sources.list' | |
sudo apt-get update && sudo apt-get install spotify-client-qt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing | |
import time | |
from browserdriver import BrowserDriver | |
def readfile(fname): | |
with open(fname) as f: | |
content = f.read() | |
#print("Read value " + content + " from file " + fname) | |
return content |