Notes and anecdotes

Techstuff rambling

Finding Javascript memory leaks with Chrome Developer tools

Check out for an interactive video on this topic.

Profiling JavaScript in Chrome Developer Tools

Open devtools Select Profiles Select Collect JavaScript CPU Profile Click Start Do the (typically slow) things you wish to record Click Stop You now got a table of functions, and CPU time they consumed. On the right hand side of the table, you got a link to the js file and its line number of the function that is…

Continue Reading

Chromes Awesome Developer Tools

Here is a great talk about them Chrome tools. You can emulate reduced network speed You can emulate other device You can force states (:active etc) for elements You can smartprint objects You can group console logging You can time sections of the code or timestamp all logging You can insert debugger stops debugger; You can…

Continue Reading

Sending SMS from python via your phone

Sending SMS using is nice, but it also costs money. If you want something free that you can use for your hobby projects, check out If you sign up (it’s free), you can push SMS with the following: Sign up at Get the app Install pushbullet with pip: pip install Find your API key here…

Continue Reading

Add S3 bucket using awscli (example)

Here’s a simple step by step guide on how to create a s3 bucket, with an attached cloudfront and a user with write access. This is typically what you want if you need quick hosting for static files for you website. This is made in contrast to the terraform guide, which does the same, but using different tools If…

Continue Reading

Django on Heroku with AWS S3 bucket for static and media files

Case: You want efficient collectstatic and serving of files You want static files and media files to be hosted on an AWS S3 bucket. (optional) You have too many files for “normal” collectstatic to be efficient. (optional) You have a non-US S3 bucket. (optional) You use Heroku Disclaimer: Have not tested with python 2.7, can’t…

Continue Reading

Add S3 bucket using Terraform (example)

Edit: I was going to make the s3 bucket with cloudfront, but Terraform has no native support for it, though it looks like it’s coming soon. I’ll probably make a followup later. Edit 2: I made a followup on how to do it with Cloudfront A concrete, developer friendly guide on how to create a proper s3 bucket with…

Continue Reading

django rewrite / redirect to new urls

I changed the MEDIA_URL and STATIC_URL, but wanted the previously used urls “/media/” and “/static/” to rewrite to the new url. It would better be done via your DNS settings, or with an .htaccess file, but can also be done via if your circumstances don’t allow the other two. from django.conf import settings from django.views.generic.base import RedirectView […] if settings.MEDIA_URL…

Continue Reading

curl headers only

How to grep only the response headers

Show environment variables in Heroku

I was looking for WEB_CONCURRENCY environment variable on my Django-app. This is used for the number of concurrent webworkers for gunicorn, and is automatically scaled depending on the memory usage of your app. Do it with the toolbelt, and command heroku run printenv –app your-app-name | grep WEB_CONCURRENCY Read more on optimizing your app here

Monitor-driven development

Monitor-driven or Metric-driven development (MDD). It’s becoming more and more relevant parallell with continuous delivery, devops etc, and I think it’s super awesome. Stop finding bugs. Instead, log properly, and monitor where and in what situations error logs are being created. Has there been a sudden increase in a certain type of errors? Get told! Stop checking if…

Continue Reading

Creating a presentation

People still call presentations or slides for powerpoints. That’s kind of funny. This could be an anecdote about that, but it’s not. I’m about to make some slides, and I wonder what applications to use. So here’s some notes instead. I googled around, and liked these two: The first is really the visual editor implementation of the…

Continue Reading

Parallax. CSS it, please.

Parallax is hot. But in so many implementations, it’s not. Because it’s implemented shittily. Parallax shouldn’t be done with Javascript, because then it might end up like this: so laggy it breaks my heart. It should be done with CSS. Jsfiddle  

Export data from one Django to another over ssh

Sometimes I clone a repository with Django and make a setup of the environment on my own machine. Then I would usually like to have some testdata populated in my environment. So here’s how to copy the data from one Django installation (production) to my environment (test). 1. ssh to the remote server ssh username@hostname 2. Navigate to the folder…

Continue Reading

The easy way of sending newsletter emails

I’ve been working a bit with automatic emails, newsletter etc. lately. And if there’s one thing I have to say, it would be: FUCK OUTLOOK. I’ve spent so much time doing stupid style changes for an html email to look nice in Outlook 2011, Outlook Web App and Outlook 2013. It’s like they render html mails with three completely different…

Continue Reading

Django + Heroku bootstrap

It has happened on more than one occasion that I want a new Django project, with Grunt, jQuery, Bootstrap, Font-Awesome etc, deployed on Heroku. So I decided to write down the steps, and made a bash script to automate it all for me.

Center content in HTML mails for OWA

Edit: Stop what your doing. It’s hurting, I know. Go read The Easy Way of Sending Newsletter Emails. Outlook Web App is horrible. Lead me to write <html> <body> <table width=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″><tr><td align=”center”> <!– This is your container, you can shrink this if you want, but it’s not recommended to go over…

Continue Reading

Reverse trackpack scrolling direction on Windows 8

Easy. See

Sending and receiving JSON over Bluetooth

I’m new to the whole Bluetooth communication game, but in my case I’ve run into having to communicate using 8-bit usigned integer arrays (I’ve used Cordova libraries to communicate with Arduino chips). In order to do this I’ve had to convert from and to JSON structures on the Cordova side. I’ve done this with the…

Continue Reading

Fresh Macbook and a set of neat tools

I recently bought a Macbook Pro Retina (Late 2014) with 128 GB of storage. I thought that if I needed 256 GB, I could just buy a regular SSD and swap them. Turns out i can’t. Or.. I can, but it’s a special SSD that costs a third of a new Mac. And I just…

Continue Reading

1 2 3 4 5