Default startup page on Ubuntu guest session

I’ve been setting up some salvaged laptops for a local refugee center, running linux, and wanted to open a webpage automatically with useful information when a user logs on as guest. I did some googling, but found the explanations pretty confusing and convoluted.

The solution is pretty simple, when you first figure it out. This is how I did it on my laptops, running Ubuntu 15.10. (It should also work from Ubuntu 14.04):

1. Log in as admin, and start the terminal and enter the /etc directory by typing cd /etc.
2. Create the directory guest-session, by typing sudo mkdir guest-session. Enter the dir by typing cd guest-session.
3. Typed sudo gedit This opens the text editor gedit with an empty document. Enter firefox “” and save the document. Close gedit.
4. Log in as guest, and the url you wrote should open.



Skulle egentlig ha dette prosjektet ferdig til Trondheim Maker Faire. Prototypen funker, og spiller av samples når man holder nede knappene, men rakk ikke gjøre orgelet helt ferdig.

Drivorgelet spiller av lyder fra havet, og knappene har LEDs som lyser opp gjennomsiktige mangefargede klinkekuler.

Logikken gjøres på pc (i nettleser) via web audio api, og knappene er koblet til en keyboardemulator.

Eta: Neste Maker Faire?


Utskrivbar frøpose (Printable seed packet template)

Høsten er her og frøbelgene strutter. Har vært i hagen og samlet frø fra rukkola, reddik, erter og brokkoline etter hvert som de har blitt modne, og etter en tid til tørk inne er det klart for å putte dem i papirposer for oppbevaring til neste sesong.

Lette litt rundt på nettet for å finne en nedlastbar mal for å skrive ut frøpakker, men endte opp med å lage en selv, som jeg ville dele med andre hagegale :)

Malen er laget i Google Drive, gå hit for å se den, og lag din egen kopi for å redigere. Send gjerne et bilde av din frøpose i kommentarfeltet eller på mail, artig å se hvordan andre folk gjør det.

In english:
It’s autumn, and time for gathering seeds from the garden. Did som googling to find a free editable template, but had little luck. So I decided to make one myself, as a Google Drawing to make it easy to share and edit for other garden-lovers out there. Enjoy!

Go to Editable and printable seed packet template

How to make the Get The Image WordPress plugin to work with TimThumb and Related posts

I’ve been using the wordpress plugin ‘Get the Image‘ by developer Justin Tadlock for a while. ‘Get the image’ does a fantastic job searching through posts looking for images, so you don’t have to add thumbnails manually, but it always bothered me that it downscaled images in the html instead of scaling and cropping them properly. I also use the lovely timThumb script on my blog, to scale, scrop and cache images on the fly, and I wanted to find a way to combine the two scripts into one.

Fortsett å lese «How to make the Get The Image WordPress plugin to work with TimThumb and Related posts»

Delicious Screenshots – my first wordpress plugin

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /customers/7/5/b/ on line 75Warning: file_get_contents( failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /customers/7/5/b/ on line 75Warning: Invalid argument supplied for foreach() in /customers/7/5/b/ on line 79

If this works there should be about 6 thumbnails on this page, showing links bookmarked using Delicious, and tagged with “art”.

Download here, version 0.7 of my very first wordpress plugin.

Activate plugin. And add your username to the options page. (under settings in the WordPress toolbar)

14.02.2017: Changed from rss to json and cleaned the code up a bit. Also removed Snapcasa from options.

What’s next:

  1. The first version of this plugin used Snapcasa for creating thumbnails, but I switched to to get a higher success rate.
  2. The count param doesn’t seem to do anything when calling the api, it always returns 10 results, so I need to handle that in the code instead. I’ve notified them of the bug.
  3. Testing other screenshotting services or making my own.
  4. Choosing an image from the page metadata when available.

Playing with SnapCasa screenshots and

Tonights nerdfest will include trying to use the SnapCasa and to generate a lovely page full of thumbnails, one for each url.


1. My 100 latest bookmarked urls from
2. A SnapCasa login account.
3. A server that supports xslt transformation. (I’m running MAMP on my macbook, and pappmaskin is hosted on
4. A text editor. I’m using Dreamweaver for this, since it has some pretty good tools for building xslt. (Take a look at the Adobe Livedocs for more info on using it).

(More after the break)

Fortsett å lese «Playing with SnapCasa screenshots and»

Processing: Sketch_081001a, and how to embed a sketch in a wordpress post

Screenshot of processing app

I downloaded my first copy of Processing ( a few years ago, but I have never gotten past the initial few demos and small tutorials. I’ve been interested in generative computer art for many years, ever since I first saw the work of Marius Watz in the mid nineties and had a stint reading dadaist poetry and cutups, but I’ve never had the time to play with this stuff myself. Or the brains to handle the math, hehe. But then I came across this tutorial in Computer Arts #149 (The June 2008 issue), where there are a few really interesting tutorials, which basically gives you enough info to understand the key consepts that you need to create some very interesting apps, like the one below (slightly modified of course, I added random colors among other things).

(java applets no longer functions in Google Chrome). Nothing you can do about that.)

Oh, and I had quite a hard time finding out how to embed my app in my wordpress blog. I kept getting some heavy errors when I tried to post the html the Processing software generates straight into WordPress, but I eventually got it to work. Since I couldn’t find any tutorials on how to do this, I decided to write my own. So here it is:

How to embed a processing java application in wordpress:

First, you have to turn off the Visual editor for your user, if you don’t, wordpress will 100% garanteed screw up your code. And remember, if you turn the Visual editor back on after finishing editing your post, then DON’T open the post for editing again. When I did this wordpress replaced my embed code for java with a flash embed code!!! Luckily I had saved this article as a Google Docs document, and could simply copypaste it in here again.

(* Update: This might also be related to Adblock plus, but needs to be verified)

Second, paste in this code (just remember to replace the variables with where you’ve put your own .jar file etc. You get all the info you need when you choose File and Export in Processing, and open up the resulting index.html file in an editor of your choice. Note: the applet tag is slightly depricated, so I guess I have to figure out to do this with a “proper” object + embed.

<APPLET name="sketch_081001a" WIDTH="500" HEIGHT="500" archive="" standby="Loading Processing software…" codebase="" code="sketch_081001a" mayscript="true" scriptable="true" image="" boxmessage="Loading Processing software…" boxcolor="#FFFFFF"><IMG SRC="" WIDTH="1" HEIGHT="1" /></APPLET>

Source Code:

And here is the source code for this lille app, just create a new Sketch in Processing and paste it in and run it. Should work like a charm.
int x1;
int x2;
int x3;
int y1;
int y2;
int y3;

void setup() {

x1 = width/2;
y2 = height/2;
x2 = x1;
y2 = y1;
x3 = x1;
y3 = y1;

void draw(){
//for (int i=0; i<1000; i+=1) {
x2 = constrain( (x2-20+(round(random(40)))), -30, width+30);
y2 = constrain( (y2-20+(round(random(40)))), -30, width+30);

//draws a triangle
triangle(x1, y1, x2, y2, x3, y3);

// the triangles are joined here



Or get the source code here: sketch_081001a

Open source flash-based sound sequenzer

I’ve been thinking alot about making a soundbased installation in Adobe Flash, using sensors and switches, and I’ve gotten around to making a few small eksperiments/prototypes as research, which I’m planning to share on this site later.

But I also found this old experiment I wrote in Flash 5 (!) and wanted to share it. It is a visual sequenzer (*) / sound toy that lets you drag icons onto a “soundstage”, each icon representing a sample. As you press play a line starts moving vertically, and as the line hits one of the icons, the corresponding sound is played. You can also click, drag and hold an icon, and move it on top of the moving line to trigger the sound. There are two types of sounds. The yellow icons trigger different “wet finger on glass” sounds, and the greywhite icons trigger sonar ping sounds.

Open Source

The code is pretty old, and there are WAY better ways of making something like this with AS3, but still, here is the source code (fla) for it (it also includes the samples, which you are free to use in any way you like).

I still think it is a pretty nice little project, but I am toying with the idea of replacing the click and drag with a webcam mounted in the ceiling, and letting people moving around on the floor trigger the sounds. I have quite a lot to learn before I can make something like that, but I’ll get there!

* Ok, so I guess it is a stretch to call this a sequenzer, but I wanted to create a fun, easy and interesting way to generate a sound collage.

Code: Showing a list of youtube videos using gdata and xslt with php

Let’s start with a little demonstration. The section below is made by calling the php-script within an iframe:

Why iframe?
Just to make it easier to reuse and embed Youtube videos on different sites, and because it makes it easier to try out new ideas without adding messy bits to a larger project. Sort of like rapid prototyping/proof of concept before “committing” to a feature and spending alot of time integrating something you might end up throwing out.

This solution currently consists of these files:
youtube.php, takes s=whateveryouwanttofind and max=number of videos to return as GET parameters
youtube5.xsl, does all the transformation of the xml from youtube into lovely xhtml.
youtube.js, javascript file that handles clicking on the thumbnails to load a new video, using innerHtml
youtube.css, minimalist styling to keep things pretty.
swfobject.js, for embedding flash

The xslt:

<?xml version=”1.0″ encoding=”UTF-8″?> <xsl:stylesheet version=”1.0″ xmlns:xsl=”” xmlns:fn=”” xmlns:gd=”″ xmlns:media=”” xmlns:n1=”” xmlns:openSearch=”” xmlns:xdt=”” xmlns:xs=”” xmlns:xsi=”” xmlns:yt=”″ xmlns:altova=””> <xsl:output method=”html” encoding=”ISO-8859-1″ doctype-public=”-//W3C//DTD XHTML 1.0 Transitional//EN” doctype-system=””/> <xsl:param name=”SV_OutputFormat” select=”‘HTML'”/> <xsl:variable name=”XML” select=”/”/> <xsl:template match=”/”> <html> <head> <title> – Youtube playlist</title> <link rel=”stylesheet” href=”youtube.css” media=”screen” /> <script type=”text/javascript” src=”youtube.js”></script> <script type=”text/javascript” src=”swfobject.js”></script> </head> <body> <div id=”youtube”> <h1>YouTube Playlist</h1> <xsl:for-each select=”$XML”> <xsl:for-each select=”n1:feed”> <xsl:if test=”n1:entry[1]”> <div class=”youtubevideo”><div id=”cur_video”> <xsl:for-each select=”n1:entry[1]/media:group/media:content”> <xsl:if test=”@type = ‘application/x-shockwave-flash'”> <embed> <xsl:attribute name=”src”> <xsl:value-of select=”@url”/> </xsl:attribute> <xsl:attribute name=”width”>480</xsl:attribute> <xsl:attribute name=”height”>385</xsl:attribute> <xsl:attribute name=”quality”>high</xsl:attribute> <xsl:attribute name=”bgcolor”>#000</xsl:attribute> <xsl:attribute name=”id”>cur_video_swf</xsl:attribute> <xsl:attribute name=”name”>cur_video_swf</xsl:attribute> </embed> </xsl:if> </xsl:for-each> </div> <!– ends cur_video –> <div id=”cur_video_title”> <xsl:value-of select=”n1:entry[1]/n1:title”/> </div> </div>    <!– ends youtubevideo –> </xsl:if> <div class=”youtubethumbs”> <xsl:for-each select=”n1:entry”> <xsl:if test=”position() > 1″> <xsl:for-each select=”media:group”> <div class=”youtubethumb”> <xsl:for-each select=”media:content”> <xsl:if test=”@type = ‘application/x-shockwave-flash'”> <a> <xsl:attribute name=”href”>#</xsl:attribute> <xsl:attribute name=”onmousedown”>PlayVideo(‘<xsl:value-of select=”@url”/>’,’’, ‘Youtube’, true);</xsl:attribute> <xsl:attribute name=”onclick”>return false;</xsl:attribute> <xsl:for-each select=”../media:thumbnail[1]”> <xsl:element name=”img”> <xsl:attribute name=”src”><xsl:value-of select=”@url”/></xsl:attribute><xsl:attribute name=”lowsrc”>lowsrc.gif</xsl:attribute><xsl:attribute name=”width”>100</xsl:attribute><xsl:attribute name=”height”>60</xsl:attribute> </xsl:element> </xsl:for-each> <xsl:value-of select=”../media:title”/> </a> </xsl:if> </xsl:for-each> </div> <!– ends avslutter class youtubethumb –> </xsl:for-each> </xsl:if> <!– end if on position > 0 –> </xsl:for-each> </div><!– ends class youtubethumbnails –> </xsl:for-each> </xsl:for-each> <div class=”youtubefooter” style=”clear: both; color: #999999; font-size: 0.8em;”>Disclaimer: These videos are retrieved from Youtube through a simple search. Even though the search is done with a filter to remove “inappropriate material”, it may still contain videos deemed offensive by some. Videos may or may not be in violation of international copyright law.</div> </div> <!– avslutter id youtube –> </body> </html> </xsl:template> </xsl:stylesheet>


$searchterm = $_GET[“s”];
$maxresults = $_GET[“max”];

/* load the xml file and stylesheet as domdocuments */
$xsl = new DomDocument();
$inputdom = new DomDocument();


$inputdom->load(“” . $searchterm . “&max-results=” . $maxresults);

//if you want to test with a local file

/* create the processor and import the stylesheet */
$proc = new XsltProcessor();
$xsl = $proc->importStylesheet($xsl);
//$proc->setParameter(null, “titles”, “Titles”);
//not in use, but needed if you want to pass variables into the xslt from php

/* transform and output the xml document */
$newdom = $proc->transformToDoc($inputdom);
print $newdom->saveXML();