Johannes Peter Assorted Code snippets and Dev devices

An Overview Of K Means Clustering

What is K-means?

It is a clustered, unsupervised learning algorithm

What do you use it for?

You have n objects and want to split them into k groups. n is normally much bigger than k, so you want to have multiple objects per group.

For example:

  • You have n addresses and want to build k post offices to best cover them all.

We will first cover the case where we know k, but you might also want to figure out what the best value for k is.

Continue reading...

Understanding Symbolic Links

Symbolic links, or “Symlinks” are a fundamental part of the Linux toolbox. They allow you to make a file or folder accessible from another location as if by reference.

Symbolic links are used everywhere in Linux. Many applications like apache2 and nginx require them for their configuration files, and they can be a powerful tool for your workflow.

Continue reading...

Fixing Jekyll Serve On Windows

This blog is hosted on github pages using jekyll, a static website generator.

While there are several guides for installing jekyll for Windows (official github pages article, Run Jekyll on Windows) They seem to skip some key points that have given me trouble with the latest version of ruby (2.3.3 as of this writing) on Windows 10.

Having struggled through this twice now on two separate Windows installations, I’m making this guide so that at least I’ll be able to refer to it quickly. I hope it helps anyone else that has issues getting jekyll serve to just work as intended.

Continue reading...

SSH Workflow Tips

Here is a small collections of tips and tricks with the intention to help improve usability and general productivity when ssh-ing into a linux machine. It was written with Ubuntu/Debian in mind, but should also work on other linux versions such as Mint.

What this post covers:

  1. Use history and grep
  2. Use the command line faster
  3. Use nano for config files
  4. Some useful applications
  5. Customize your .bashrc file

For the most part these are all fairly straightforward and this post will probably contain nothing new for anyone that has a fair amount of linux experience.

Continue reading...

Port Forwarding SSH from Virtual Box

In this post I will discuss setting up port forwarding to manage a local linux virtual machine through ssh, with a focus on mirroring the workflow you might follow with a dedicated Linux server.

This guide will be using Ubuntu 16.04.1 and MobaXterm as the SSH client. You are welcome to use another SSH client such as bash for windows in Windows 10 if you so choose.

Continue reading...

Getting Started With Premake

This initial post will cover what Premake is, why you should use it, and provide an example project you can download and try out for yourself.

Future posts will expand on the provided example by walking through the process of setting up more complicated premake configurations, such as cross-platform libraries and dependencies.

Continue reading...

Fixing Make Exception on Windows

The Problem

Some versions of gnu make for windows can encounter an exception when you try to run a make file with them:

make: Interrupt/Exception caught (code = 0xc0000000, addr = 0x00000000)

I encountered this issue, and eventually stumbled upon a stack overflow question, the top answer of which recommended explicitly passing SHELL variable. This did indeed fix the problem for me:


Solution 1 - The Quick Fix

When running make, pass in this SHELL variable:


Either along with the command line arguments, or just add it to the top of the make file.

This solution works, but doesn’t fix the actual problem: why is make unable to find the shell?

Continue reading...

Installing clang++ to compile and link on Windows : Part 3

Approach 2 - MSYS2

In this approach we’ll be installing MSYS2 to create a unix-like dev environment on windows that we will install clang and gcc on. That dev environment will then be interacted with through its bash shell.

Continue reading...

Installing clang++ to compile and link on Windows : Part 2

Approach 1 - Clang 3.7

In this approach we’ll be installing Clang 3.7.0 and gcc 5.1.0 (via MinGW-w64), to allow us to build and link with clang from the standard windows command prompt.

Continue reading...

Installing clang++ to compile and link on Windows : Part 1

The Problem

In the past I’ve struggled getting clang to work on windows in as complete a capacity as it does on mac or linux.

I tried a few online tutorials and suggested solutions on stack overflow, but all of them had one drawback or another:

  • Some solutions required you to use a separate linking step (since as of the time of this writing clang for windows does not have its own linker)
  • Some solutions required massive -I and -l compiler flags so that all the proper headers and libraries were used.
  • Even when some solutions mostly worked, they often were unable to handle both 32 and 64 bit.
  • Some required you to build clang from source. Not a problem in its own right, but not very convenient, especially when compared to other platforms: apt-get install clang-3.5, brew install llvm --with-clang --with-asan, etc.

So over the last month I tried to come up with a reliable tutorial to get clang to compile and link on windows 8.1 that would avoid these issues.

Continue reading...
comments powered by Disqus