Let’s talk a bit about memory management

So after almost finishing my class on operating systems and memory management (at the easy and superficial stuff) i’ve always wondered how one can put all the theorems in a touchable context, and right after i went into the bathtub it hit me.

I’m not talking about memory management methods right now, just if you have no idea about it, think of all the methods you COULD use to fill an array or slice (talking golang now) with other arrays or slices.

The thought is rather easy, let’s say you have an empty slice with len(s) = 32 and you need to fill it with an amount of other slices that are filled with whatever, some random data. The first iteration of data would be pretty straight forward, just putting them at the first free position (concerning it doesn’t exceed the length of the array, in this case 32) – otherwise it should either be rejected or enqueued. Now the fun part begins when you delete random slices from within the slices (e.g., s[0..7] and s[11..14]) and then try to put new data in there.

Now if you’ve got two slices enqeued with len(q[0]) = 4 and len(q[1]) = 8. In case you just put the data in the first fitting (Hint: That’s a keyword) place, there’s no more room for q[1].

This is easily adaptable without even having to get on a lower level of memory management on the OS abstraction level. You can play with this idea – if you’ve got sample implementations of this “problem” (I wouldn’t call it problems, but make of it whatever you want), hit me up so i can link them here 🙂

UPDATE: I did some untested stuff in a go playground, you can play with it. https://play.golang.org/p/ei5QgXBh_7S


The last few nights seriously took my energy level to a new low. Maybe part of that problem is the fact that since I’ve build this depression I’ve been watching Twitch-Streams to sleep in. Bad, bad, baaaad idea. So now i want to get rid of that and instead listen to soothing music when i get to bed. Not that hard, but somehow i don’t want my phone to be responsible for that. And my laptop? Way too loud, too much energy drain, etc.

So what do we do?

Easy peasy, let’s build an AlarmPi – and now that we’re on it: Let’s use it as an alarm as well. And now that we’re on it: Let’s build a mobile App so we can change all the settings. So, in my terrible sleepless idea-digging I figured i need the following things:

  • A playlist with soothing music (YouTube?)
  • A playlist with music to wake up to (YouTube?)
  • The possibility to set volumes, etc.
  • A neat web interface
  • A randomizing-button so we don’t get up to the same shit
  • A mobile app to control the neat web interface
  • Alarm Clocks (more than one?)
  • If more than one alarm: different playlists for different occasions?
  • Maybe some timers on when to start the soothing music and when to stop?

Looks reasonable, eh? So the Raspberry Pi is sitting on my desk, now let me get a few appointments out of the way (math exams, hooray.) and we’re off to go.

I’m still wondering if Go is the right language for that or whether i want to try something new. Suggestions?

Escape Artists

I balance myself high up on a wire that i spun over the life that I‘ve just recently figured was full of fear. Desperately trying to hold onto the little breaths i kept hidden in my lungs, while i took a stroll into the night everyone told me to become a part of.

I am made of about 6 litres of blood, some bones, flesh and a brain, that oftentimes interferes with my heart that‘s beating just a tad too fast. My daily dosis of antidepressants is high enough to keep my self-loathing in a cage, but too low to let me put a straight smile up on my face. My past keeps revisiting my thoughts, thus my future is an unstable construct of high hopes and even higher falls. I am 50 percent self-proclaimed fear, 30 percent that „helpful friend“ and the rest of the time i keep telling myself that i‘m not good enough for anything or anyone.

But i‘m not alone in this, we are am army of escape artists out in this world, yet we remain silent so noone blows our covers. Cover us with oil as we slip out of any given situation, we are the black sheep, overseen by society, we keep our secrets hidden and our porcelain hearts locked in our chests. So even if you get to take a glimpse, it‘s just a matter of time until we admit that knowing us is a mistake.

We are trapped inside a mindset that keeps on giving us reasons not to stay somewhere for a longer period of time; give us love and we tell cupid to shut up and not waste any more arrows on something we are not ready for, never was, possibly never will be. We put on armors of past mistakes as if we need a reason to run for cover.

We write thank you letters to past relationships in our nicest handwriting, thanking you for the time spent, for the hours you witnessed a downfall, with a golden – yet meaningful – message that reads like a loveletter from your greatest fears, as you once were this person who had control over me. And i held my little breaths, until i snapped and it bursted out – the moments where nothing but my voice and your face existed. And i was sitting there, but all these words were meaningless since you did not even show up, not even in my thoughts, not even in my dreams.

And then my phone rang, your breathing was easily distinguishable from all the other noise these ears have ever heard, as i used to listen to it for way too many silent hours where we didn‘t speak a word. Unlike this call, where i grasped the last few words i wish i would ever have heard of you.

„I miss you, please don‘t leave me, promise you won‘t leave me.“

But then i woke up – not from a dream, but from reality – and i couldn‘t cry for the sake of it. If there was ever a tear coming out of these eyes, i will dedicate them to you. They will carry your name. For as I am going to remember each and every minute we spent. Each one in vain.

And yes, I would‘ve said that I really really do miss you, too. I miss the feeling of being around you, i miss each and every broken thought that rooted in any of your words. And I miss feeling exchangable, i miss that i cared too much, i even miss being the wreck i was, because after you, i just wasn‘t able to miss anything anymore.

But even if we‘d meet again i know, i just know, know know that i‘d giggle like the little boy i always was when our eyes met. I‘d stutter in the tiniest of notes, in my most fragile tones, like you‘re the vacuum that sucks in any confidence that was still left in me. And i wonder if this ever ends, and i bend myself backwards thinking i don‘t think about it that much anymore. I will tell myself that i don‘t need you, i don‘t need you, don‘t need you, need you, need you. I need you, I need you to tell me that there was never anything worth waiting for. I need you to tell me that this self-proclaimed suffocation never stood for anything good. I need you to get a grip and finally leave this head, because even though i left you, you never left me.

PiDioder Tutorial

Hey folks, i finally found all the old links and descriptions and images for this tutorial, will probably update it in the next few weeks (As of Feb 20th).


The Materials you need:

  • Voltmeter
  • Some cables
  • Soldering Gun (and accessories)

if you know how to use it, you should always try to measure the voltage between the mass/ground and the source you’re working on, i will add the voltages that are expected
in this tutorial.

the hardware part

Step 1

2013-12-08 12.40.53

open the box with a screwdriver, you can damage it, but i would strongly suggest you be careful – cause you might want to use it later on

2013-12-08 12.41.26

this is what the box looks like if you opened it without damaging it. you can easily pull out the circuit board now.

Step 2

now you should mount it on a stand or somewhere similar to have a solid working base that doesn’t move while you’re working. this is how the UNCHANGED circuit board looks like.

2013-12-08 18.20.01

now you need to disconnect the existing connections between the mosfets and the potentiometer wheel-thingy (help me out, what is this thing called?) (thanks to /u/CastleSeven for giving me the right name).


click on the image to view it in full size. on this i already cut the connections between the mosfets and the potentiometer. i’d recommend you to scratch off the first layer first to make the copper-connections visible and then disconnect them at the exact positions i marked on the image. otherwise you’ll have problems soldering your new wires on it.

Step 3

2013-12-08 18.23.46

now you need four wires (one for each channel and one for the mass), try to keep them the same length. it will help you in the end.

Step 4

voltages between the mass (blue cable on the bottom) and the connections before the mosfets (the three big black blocks) should be 0V right now. if it’s not zero, you need to scratch a bit more.


the mass wire! you need to solder one of your four wires to the blue wire on the bottom of the image (the one that has the description “-” on the circuit board). hint: paint the other end of the wire in some color so you know it’s the mass wire, it will come in handy.

you need to skin the ends of the new wires, whirl them up and solder them to the three points i marked with the numbers “1”, “2” and “3” – beware! the wires for point 2 and 3 should not touch each other!
the three numbers represent a color in the RGB color space, i’m not sure which mosfet is in charge of which color. if you figured it out (mine is already finished and i can’t access the board anymore) please let me know.

2013-12-08 20.20.42

this is what your board could/should look like after you’ve soldered all the wires and probably did some fixation of the wires.

Step 5

2013-12-11 02.00.54

i used a 26 pin socket connector to connect the wires to the corresponding pins of the gpio outs. take a look at the pinout scheme for the pi on this page: http://modes.io/raspberry-pi-serial-communication-for-fomophobia/

for software reasons we need the following pins:

  • Ground (Mass), which should be connected to the mass wire
  • GPIO 4
  • GPIO 17
  • GPIO 18

i will explain what this is about in the software part of this tutorial.

2013-12-11 02.01.33

i used a Ferm CTM1010 to cut a hole in the case i got for the pi for the wires. simultaneously i widened the hole for the power cord on the original case of the circuit board. then i closed the whole thing with some bandage tape

Step 6

actually you should be done with the hardware part right now. to the software part!

the software part

we are going to make use of sarfatas pi-blaster library – which enables PWM (pulse wide modulation) on some GPIO pins. now you know why we used some specific pins. all credits belong to his awesome work!

Step 1

as i’m not going to tell you how to install an operating system on your pi we start by following the how to from the pi-blaster github page

Step 2

check if everything is working correctly by typing echo "0=1" > /dev/pi-blaster into a terminal. mark the color you see and then undo it by typing echo "0=0" > /dev/pi-blaster you will need the numbers of all three colors, so do the same with 1=1 and 2=1

Step 3

if every color works and you know the number of the color, clone my small go-pidioder project on github and run it (you need go for it to work). take a look at the main.go file and change the consts to the values you wrote down. start the server by typing go run main.go and wait for it to start. it simply starts a small webserver on port 1337. if you can open the website and click one of the buttons, you’re done! have fun!

help me help you

I’d love to make a video tutorial for the pidioder as well as update the information concerning newer versions of the IKEA Dioder and the piblaster library. but sadly i currently can’t afford anything (being a student seems to have its drawbacks i guess) – so if you’re interested in helping me create updated versions i’d kindly ask you to make a small donation 🙂

in action

this is just a small thing i hacked together to show some “random disco mode”.


big thanks to nemo for figuring out the technical stuff

feel free to contact me for any further information or if you think something is missing in the tutorial.