Elixir and breakpoints in Visual Studio Code
I have, for a long time now, thought it wasn't possible to use breakpoints in Elixir with Visual Studio Code. Turns out I was wrong. After doing a Google search for something related, I came across this article: Elixir Development with Visual Studio Code It explains how to use Visual Studio Code's debug feature in combination with Elixir. This allows you to use breakpoints and it seems to work quite well. Basically, all you need to do is to add a configuration in a file called launch.json in...
Read post
Visual Studio Code keybindings
Here's a (growing) collection of useful keybindings for Visual Studio Code that I use or deem interesting. I've probably found most of them, if not all of them, on various sites on the internet. In those cases I've added a link to the source. Switching between editor and terminal // Toggle between terminal and editor focus { "key": "ctrl+`", "command": "workbench.action.terminal.focus"}, { "key": "ctrl+`", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus"} Source:...
Read post
Sublime Text 3 – creating a plugin
I've written npaste, a simple pastebin for text and images that supports encryption using GPG. After a while of using it via the command line I felt the need for a plugin for Sublime Text 3 and also Visual Studio Code. In this post I will explain how I created the plugin for Sublime Text 3. Resources The ST3 plugin API is pretty well-documented, and there are also some resources available on the Package Control website that explains how to create a plugin. Despite this I had to do some researc...
Read post
Pretty-print JSON on a Mac
I've written npaste, a simple pastebin for text and images that supports encryption using GPG. My work involves a lot of JSON that I often need to share with others via Slack or other communication platforms. Sometimes the output is quite big and not very suitable for sharing inline. And in some cases the contents are sensitive and should not persist on the internet longer than necessary. In this post I'll collect and present some useful commands that can be used to paste, format and share prett...
Read post
How I keep my inbox tidy and clean
I have two email accounts: Work Private The one I use the most is by far my work email. This account mostly receives emails that are addressed to me directly. My private one, on the other hand, receives some spam, which is mostly being filtered out by my spam filters, and a lot of what I call «unimportant email». «Unimportant email» are messages that I mostly don't care about and don't want to be notified about. I'd still like to receive them and be able to review them. The Setup I run ...
Read post
Change file encoding in Vim
This is for my own reference, I always forget how to do this.. Once :w[rite] ++enc=utf-8 [filename] Persistently :set fileencoding=utf-8 ...
Read post
Basic server setup (Ubuntu)
Disclaimer: This short guide is basically just a reminder to myself, where most of the content is based on Digital Ocean's Initial Server Setup with Ubuntu 16.04 and my own memory. There are some important steps that aren't included in this guide. If you're new to Linux or Ubuntu, I suggest that you read Digital Ocean's guide instead. All commands in this guide (unless otherwise stated) assume you are currently logged in as root. Add a user We don't want to use the root user when logging in...
Read post
Disabling password for sudo in Ubuntu
Disabling the password needed for sudo for a specific user is very easy in Ubuntu. This method applies to Ubuntu 16.04, but probably also other versions of Ubuntu and maybe even other distros. First, run the following command: sudo visudo Note: If this is the first time you're running this command, you'll most likely be presented with a list of editors to choose from. Choose the one you're most comfortable with. Then enter the following line at the end of the file: user ALL=(ALL:ALL) NOPASS...
Read post
Ludum Dare 39: PowerClick
I attended the online game compo Ludum Dare 39 this weekend. Because of things I wasn't able to start until saturday evening, so I decided to create a very simple game this time. Last time I created my first 3D game, Parking Zone. I spent most of the time creating the 3D models and getting the wheel colliders to work the way I wanted to in Unity. For LD39, I decided to create a very simple UI based 2D game. «Running out of power» This time the theme was «Running out of power». The game only h...
Read post
Ludum Dare 38: Parking Zone
Ludum Dare is a game jam/compo that happens three times every year. The jam lasts for 72 hours and the compo for 48 hours. There are different rules for the two categories. This was my first time participating in the event, and I submitted my game to the compo. The most important rules of the compo are: You have to work solo Every asset in the game (code, graphics, sounds etc.) must be created by yourself during the 48 hours "A small world" The theme of LD38 was "A small world". I decide...
Read post
3D model of a book
I am currently learning how to create 3D models in Blender. My first creation is a simple book. I started out with a simple cube and transformed it into the book in the pictures. At the moment, the book is just one object. I'm planning on splitting it into several objects and at some point make an animation of opening the book. 3D model of a book, top view 3D model of a book, bottom view The cover of the book is textured with a simple image I made in Photoshop. The pages are textured with ...
Read post
New website platform
My website was previously built using Jekyll and hosted on Netlify. Because of various problems I've had with my Jekyll setup, I decided to go for another static site generator: Hugo. I have been very happy with Netlify. Easy to deploy, integration with Github repos and automatic SSL certificates from Let's Encrypt - all for free! Despite all this, I wanted to become more familiar with Amazon Web Services (AWS) and all their products, so I changed my setup so that this site is now hosted in an ...
Read post
Resizing windows on linux
Here’s an easy way to resize windows on Fedora 23 and probably most other Linux distributions: Hold ALT and right click (and hold) with your mouse Move the mouse to resize Using this method the window will resize as if you hovered your mouse over the nearest corner and resized it manually. ...
Read post
Creating a bootable USB stick on OS X
Here's a simple way to create a bootable USB stick from a downloaded .ISO file on OS X. Convert ISO to IMG Open the terminal and type the following command: hdiutil convert -format UDRW -o target.img source.iso Remember to replace the paths in the previous example. Transfer to USB stick Warning: This will erase all data on your USB stick. First, find the correct device node: diskutil list After you have successfully identified your USB stick, unmount the disk (replace N with the disk numb...
Read post
Trouble booting newer Linux kernels on Asus VivoPC VM42
I recently bought an Asus VivoPC VM42 because I wanted a small and simple desktop computer to play around with different Linux distros. I was able to install Ubuntu 14.04 without problems, but when booting it for the first time it got stuck with a message from NMI Watchdog saying that CPU#1 had been stuck for 22 seconds. I also tried booting Linux Mint and Fedora from a Live USB, but the same thing happened. The only thing that was working was booting Ubuntu with kernel 3.19.0-25. I tried the...
Read post
Useful git tips
This is a collection of useful git commands, aliases, tips and tricks that I've come across or been using. Feel free to contribute to this collection by adding a comment below. Aliases for ignoring files To prevent changes in already-commited files from being commited, you can update your index with the --assume-unchaged flag for the files that you don't want to commit. Here are a couple of useful aliases for dealing with this. ignore = !git update-index --assume-unchanged unignore = !git upda...
Read post
Basic usage of git-svn
This is a small guide I wrote for my own convenience when I recently was converting an SVN repository to a Git repository. I've published it here so that I can easily look up the things I need to remember.. I've found most of these examples in the excellent official git-svn documentation. Cloning the SVN repository git svn clone <repo-url> Adding another remote git remote add <remote-name> <remote-url> Fetching and rebasing changes from SVN git svn fetch && git svn ...
Read post
Deleting rows with a LEFT JOIN in MySQL
This is something I don't do that often, and I always forget the correct syntax. Thus this post. Let's say you have a table images and a table users. Now you want to delete all rows in table images that are associated with rows in the table users that are marked as deleted. First, I usually do a visual inspection of the rows that will be deleted: SELECT i.* FROM images i LEFT JOIN users u ON i.user_id = u.id WHERE u.deleted = 1; The rows returned by this query are the rows that will be delete...
Read post
mutt tips & tricks
I've been using mutt with offlineimap and msmtp (dead link, coming soon.) for a while now, and I want to use this post to collect some features and tips that I've found myself often searching for. Finding messages in the current folder Common flags Tagging messages and doing bulk actions Untagging messages Changing the filename of the PGP signature attachment "From"-specific signatures Finding messages in the current folder The default keybinding for searching the current folder is l...
Read post
locationpicker.js
locationpicker.js is a simple-to-use jQuery plugin that allows you to select a location on a map and receive the coordinates using a callback function. It also supports searching for a location based on an address. Repository To download the latest version of locationpicker.js, visit the repository: https://bitbucket.org/kimgrytoyr/locationpicker.js/src Examples Here are two live examples of how locationpicker.js works. Modal window (with address search) Fullscreen Requirements location...
Read post
Using launchctl on Mac OSX 10.10 to run a script periodically
Lately I've been playing around with mutt, a "small but powerful text-based email client for Unix operating systems" and offlineimap, a software that downloads your mailbox as a local Maildir. After I finally got everything set up (easier said than done), I needed a way to make offlineimap synchronize my mailbox periodically. Apple recommends using launchctl instead of crontab. The following example shows how to run offlineimap in quiet mode every two minutes: <?xml version="1.0" encoding="U...
Read post
Opening Sublime Text from the command line
I'm using Sublime Text 3 beta as my text editor. It's fast and lightweight, but at the same time it's very powerful. Here's how you can open Sublime Text from the command line: ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl (if you're using Sublime Text 2, just replace the path in the first argument) If you would rather like to use another name for the command that opens Sublime Text, just change the last part (subl) of this command to whatever you w...
Read post
Case-sensitivity problem with Git in OS X
I've several times experienced problems with files and folders having incorrect case in Git repositories in OS X, so I decided to gather some possible fixes and solutions to this problem. If you have any suggestions or comments, please consider sharing it with me in a comment. Hacks First off, here's a solution published at Coderwall.com: git mv filename filename_tmp git mv filename_tmp Filename git commit -m "Set correct case for filename" The author mentions that this is a hack and that it ...
Read post
Going static
Update 2018-02-09: The information in this post is no longer current. Please read this post for information about my current setup. My personal homepage has been powered by Wordpress for several years. There's nothing wrong with Wordpress, it's a mature blogging platform with a plethora of plugins and themes to choose from. Nevertheless, lately I've been wanting to use a static site generator for my personal homepage. Here are some of the reasons why: I want to use Markdown I want to use my...
Read post