Home Archive Games Utils Paintings About Contact
April 9, 2018

Generating static web pages

I just finished updating this site a bit, making blog posts appear on the index page, generally making it more "bloggy". When I made the site I knew I did not want any comments section on the blog, so I figured I might as well generate the whole thing offline! This approach is quite minimalistic and requires little server-side infrastructure.

The generating is done using this Python script. It takes this template in which it finds where to inject the header and content. After that it scans this folder for .html-files from which the non-blog-post pages are generated.

The generating of blog posts is hard-wired to look inside the folder content/posts. Every file in there is then parsed, translating the minimalistic markup to HTML. So in order to make a blog post I just add a file to the content/posts folder, run the python script and upload the result to my server (which currently happens to be GitHub pages, since they freely serve static sites). The generation of blog posts also spits out the Archive page.

One funky thing I added was support for LaTeX markup (via KaTeX). This makes it possible to have fancy maths in the posts, making stuff such as this post about everything binomial possible. One thing I should do, but haven't, is to run the LaTeX generation offline as well, currently it is done using Javascript.

I think this setup has been very nice and it has opened my eyes to how often we overuse complicated dynamic websites and all the associated infrastructure.

December 9, 2017

Saturday

A whining noise, modulating. Sound waves smearing splat splat splat, becoming an image. Morphing, colors. It's beautiful! Oh-a-face:

"Hello!"

The world is soft. Soft face. But there's a pain. Wait, I have a neck. The pain is in my neck. But it's soft what is a wall, wall, roses. Wallpaper. Sheets, soft face neck world. What time face neck world. Maybe I should get up. What was that? Dream? Yes. Good, didn't like the face. Face? Was there a what time is it? Watch, next to pillow or maybe table-able? Able-table there-it-is fourteen thirty. Saturday, is okay.

Yes, hah, got up! First try no snooze, you snooze you lose! Neck, less pain, but not good. Should maybe go for a run later on, running compacts the back or straightens you out or maybe it's just good somehow.

Tea, mmm, yes make tea. Oh right gotta fill the form, stupid experiment. Got up? 14:30. Ate breakfast? Yes, or, will do. Wait, is it breakfast at fourteen thirty? Mark it x withaquestionmarkyes. Good. No bedtime, bedtime is later. Not a time traveler. Time betrays us all, but I'm a time traveler.

What the hell dish mountain, an ocean. No-smell-fix-later. Tea is needed. Earl grey? Cinnamon? Cup? Small pot? Pot small pot where is pot oh I cleaned it—not friends with the mountain, good. Fill up to one liter, no what, half a liter! Small pot. Ninety degrees, not hundred, so warm, can never drink. Think there's no measuring spoo- nope empty, this teaspoon will do. Teaspoon! Made for tea. But when you use different tea spoons everyday you don't get two point five teaspoons. All different, not tea. Standard, bah. Earl grey.

Did shitnothing yesterday must do shitsomething today. Fourieranalysis, no, optics, waves and optics. Okay. Haha giant coaster for pans for pot. From yesterdays computerdinner. Head not crammed. Was crammed yesterday, tried to read, loopback, nothing. Went to bed, better now? Now. The treatment of light as wave motion allows read yesterday, might as well re-read, brain unfried wavelength is considered to be negligible compared with the dimensions of oh it's the limit. What time fourteen fifty twitter NO! Looking crams head. Wrote silly shit yesterday, looking will make me crammed, potato. Over here, far away on piano. Oh, tea!

Since the wavelength of light—around 500 nm—is very small compared to ordinary objects, not good, not going so well. Well no hah it'll be okay. Wait. No. Recall that the appearance of distinct shadows influenced Newton to assert that the apparent back pains are no neck, not much back. Should really run later, compact it all, give it a good beat. Maybe later. Soon dark, who cares, cities have light. Is there snow? Shitty soon brokenagain blinders no snow.

When a ray of light is reflected in peanuts. Breakfast. I marked it x withaquestiomark. Hi mountain! It's friends with the toaster. Should turn the slices midway to make top crispy butwhocares. Tea? I just had tea. Water is good. Here's the peanut butter, last peanut butter. One kilogram of peanut butter with start at Sunday, end at Saturday. One kilogram in a week, that's something. Nice outside, good for running. Oh toast, next toast. Down, gonna eat four. Spread butter, thick like that guy in fourth grade, but that was butter, this is pbutter putter utter. Mein mutter ist en butter utter. Yes. Good putterbutter.

Bad bookprogress, but little math. Read in sofa? Okay. Connect thick euro is grinder, this is lamp no light switch is off. There. How many pillows under book? Funny prop-up-reading-style. Two? This is nice. The Dutch physicist Christan Huygens envisioned light as series of pulses emitted from each...

...

...

That is, the viewer "sees" the tip of an image point P'. Good, run? Here are long trousers, no shorts. It's December. No snow, not slippery. Dark now, city has lights. Use red hoodie? Yes. No wait, it'll get sweaty, I like this one at home oh wait I have a sporty-thing-jacket in the closet, where? There. Now, a key. Here. Oh nifty keyholder plastic clip thing in pocket good, no need to worry. Don't like uneven tied shoes, don't wanna stop, tie good, okay there. Fridge is closed. I haven't been in fridge since I checked if it was closed yesterday, this is OCD?

Not very warm, good for run. Some do warmup, I'm already running. Just run. When does one automatically start breathing heavily? Just start now. Four steps in, four out. Or should it be two-two? There's bound to be magic behind this, the ultimate breathing tec—oh there's a guy almost can't see. On phone, shadowphone.

Pavement a bit frozen. Good sand, won't die. Just down this road, up through trees around down to supermarket and home, yes good haven't run in weeks don't wanna overdo it. Just compact back a bit, or whatever this does. Breath in out. Pain in nose, cold. Okay only mouth, two-two no four-four I don't know! Two-two-four-four-no wait missed turn can I continue? Or... No just stop, back oh only ten meters there. This leads to the road towards the supermarket. Not going in but past and then home. Big circle of a run. Oh this bicycleroad is wet isitheated? Never snow, mustbeheated. Wet-water-no-ice. Around supermarket no heating now, ice again don't die it's okay there's sand. More tempo, last bit. Not long but its good, long time since run. Stop at the first house. Slippery, sand, house, stop. A cooldown walk, what do they call it? Only twenty meters, not really a cooldown, just a slow stop.

New towel, old is old. In closet, in in here. Yes. This? No big ones left. This is small, but biggest. Okay. Lets put it—this has no hanger. Why the hell. It has a silly insignia, one of those posh shitty-towels from place that find practical things like hanger ugly and spends the rest of their lives with towels living on the floor? Here's the nail clipper its sharp, there's a hole! Cut it up a bit. There. Fits. Take that posh-shitty-towel. You tried so hard, and fought so hard, but in the end you ended up uglier than the one with a hanger haha ha. Ha.

...

Runclothes here, gotta dry. Eat? No. Maybe look at phone email twitter no lookie lookie head crammed not gonna look gonna look full of cram. Clamcram. I'm not no. Look-lookie-look-look-look this is like some mad rambling thing with words like look-lookie-look-look everywhere lookie-look. Maybe I should write this down something about not looking at phones, having day, look-lookie-look-look. Alright.

Parts of this text are excerpts from "Introduction to Optics" by Pedrotti et al.

August 3, 2017

I hate money

There are lots of extravagant things to want in life. I don't want much in the ways of luxury, but it would for example be nice to travel a bit more. But that would require money. I hate money. Don't get me wrong, if I had an easy enough way to just get hold of lots of money I wouldn't mind. But I hate money because in order to get it you have to work. Working is a fantastic way to throw away your life. Spend your time. Spend your physical health. Spend your mental health. Spend all these precious unreplenishable resources, not even doing something you really like, committing to someone else's bidding. All this, so you can get hold of that cash in order to do that thing than from the get-go was an extravagant luxury.

It's not worth it.

Why?

Because in the end you'll land on minus. Oh hardy har har lets work 40 hours a week, feel like dying, so we can—in the short annual time slot where we are allowed—go to Peru and see some shit. Some shit that would have been nice to see had we not been wasted from actually getting hold of that money which allowed us to go there. Ho ho ho lets continue! Let us do this thing until we're 65 and retire so we can finally live life as old people, instead of having some kind of freedom, peace and calm in our prime years.

It's a wasted life and I'd rather shoot myself than force myself through it. I will instead do whatever minimal effort I need to get money for rent and food and in my precious spare time do things I find interesting.

July 12, 2017

Daggmask (Swedish)

Från ytterdörrens utsida hörs ljudet av skor mot trappen av trä. Ett lätt slammer från ett välslitet dörrhandtag.

"Masken" hör jag min mor säga.

Min plats är kökssoffan, runt hörnet, där jag sitter och läser. Hon är inte inom synhåll, men stegen hörs.

"Jag har tappat masken."

Ska hon fiska? Det är betet som saknas. Men hon fiskar inte. Mata höns med mask?

"Mhrrrm" grymtar jag medan hon gör entré i min ögonvrå.

"Ursäkta att jag stör."

Inte alls, men jag yttrar inte orden. Ögonen går upp och sen tillbaka till läsplattan. Hon fortsätter fram till diskhon, dricker lite vatten.

"Var har jag lagt den?"

En hand rotar i tröjan.

"Där var den! Jag är en idiot."

Blicken höjs igen, fyndet observeras: Ur fickan dras en vit skyddsmask fram. Typisk engångsmodell. Blå remmar, håller den stabilt på huvudet.

"Jaha, jag trodde du menade en daggmask" säger jag, men det är för henne inte hörbart då hon samtidigt skämtsamt rabblar "tant, en idiot-tant!"

Därefter uppfattar ingen av oss riktigt vad den andra säger, vi talar omlott. Inget ord slutförs innan ett annat påbörjats. Som en sallad.

"Daggmask."

"Tant, tant, en idiot. Tant."

Hon går ut i hallen igen.

"Daggmask!"

"Idioooot!"

Ett sista försök, den här gången hinner hon inte säga något.

"DAGGMASK!"

En kort paus, sedan ett svar:

"Nä, inte daggmask."

Dörren sluts. Jag återgår till min bok.

Ovan skildrar en nyss inträffad "konversation" med min mor

July 9, 2017

A case for emptiness

It probably doesn't come as a surprise that I dislike being in a state of sadness, but I'm not very fond of being in a state of happiness either.

What do I mean by state? Something that lasts longer that a fleeting thought, that occupies your mind, that is with you for hours.

Imagine trying to read a book. If you're in a state of sadness, it might very hard to progress without dark thoughts popping in, disturbing you. This is probably the least surprising part of all this.

Imagine being in a state of happiness. You just can't clear that happy feeling, a feeling which is connected to something that has happened in your life. Maybe an event occurred, an event that aligned with some deeply rooted expectations. This made you very happy, and the feeling has conquered your whole being. Try reading a book in this state. It might be just as hard as in the sad state! You want to pace around, giggle, tell your friends about the happy thing, etc. You can't get anything done. Happiness is just another distraction, often created by the chance event that the coin toss that is life aligned with your expectations. The times when it doesn't align, you end up in sadness instead.

So, expectations cause happiness and sadness and I find that both are just a disturbance. So I grip the problem by the root and do away with expectations. When that is done, what state should I strive for? I strive for emptiness.

But what do I refer to by emptiness?

I do not refer to the feeling people have when they say "I feel empty inside". I think that what people actually mean when they say that they "feel empty inside" is that their mind is so saturated by impressions that they feel exhausted. This bad feeling can come to me when I have too much to do, or when a terrible social gathering has taken all the juice out of me. Often when people "feel empty inside", they try to push themselves, thinking they should be able to do something productive because they have an internal "emptiness". They try to fill it! But I think that people, whenever they feel like this, are actually completely saturated with impressions and should probably lie down on a couch and have tea for the rest of the day.

Now, what I do refer to by emptiness is the feeling of neither happiness or sadness. It's a completely empty head, like a blank canvas. There are very few thoughts randomly attacking your mind. You are at peace. Try reading a book in this state. It'll be like disappearing into the text. As long as there are no linguistic or logical hiccups in whatever you're reading, it will be like intuitive understanding of someone else's thoughts, put onto a piece of paper.

While I prefer happiness over sadness, I put emptiness on a pedestal high above both.

Note that the above is true for most activities in my life. I am after all a book-consuming student. An empty mind vastly improves almost everything I do. Now, there are of course exceptions. Sometimes euphoria is a very wanted thing, sometimes even sadness is sought, but the activities connected to those states are probably exceptions to my daily habits. The things I do every day is what I find interesting in life, and none of that improves by going into them with a mind bothered by other thoughts, be they happy, sad or of some other nature.

Older posts