Posts

  • Using Key-based SSH Authentication

    If you use Git or remote terminal session a lot, consider using key-based authentication. Key-based authentication is generally considered more secure than password-based authentication. 

    In key-based authentication, two key-files are used. One is the public key and may be distributed to other parties that should be able to authenticate you and your information. The other is the private encryption key and should be kept secure.

  • Developing for AVR with JetBrains CLion on Mac OS

    Previously I used Atmel Studio 7 to do AVR development. This integrated development environment is unsurpassed in terms of ease of use and features for AVR development. However, it is Windows only. I grew tired of the hassle with virtual machines and dual boot setups as my working device is a Mac running Mac OS 10.12. I already used some JetBrains products for C/C++ and PHP development so I wanted to try to get the whole AVR toolchain working on Mac OS in combination with JetBrains CLion.

    To serve as a suitable alternative to Atmel Studio I need both compilation, uploading and debugging to integrate nicely with CLion. Furthermore, I wanted to be able to use the Atmel Software Framework to have access to an enormous resource of services, drivers and examples.

  • Pick Random Values Array Php

    PHP provides the array_rand( $arr, $num )  function which returns an integer or array containing the keys of the array.

    To obtain an array of values the following one-liner can be used:

    array_intersect_key( $arr, array_flip( array_rand( $arr, $num ) ) );

    This picks $num random keys from $arr (array_rand), flips keys with values (array_flip), intersects the picked keys with those of $arr (array_intersect_keys) and returns the corresponding elements of $arr.

    Getting random values from an array.
  • Laravel 5 Cron expression validation

    A Cron expression validator is created in Laravel 5.3. Laravel provides a versatile and extendable Validation class. Introducing new validations is done by registering a validation function with the extend method on the Validation facade. A Cron expression validator is created by utilising a cron-expression parser.

    The cron-expression parser used here is the fantastic cron-expression Composer package by Michael Dowling.

  • Restore, Clone or Backup your Homebrew Setup

    Homebrew is a popular package manager for MacOS. It provides easy access to thousands of programs and applications. It is developed and maintained by an open-source community on Github. Use Homebrew bundle to backup and restore your Homebrew configuration. 

    If you haven’t installed it yet, go take a look quick on brew.sh or just install it by running the following command in the MacOS terminal.

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

    The installation should succeed without problems. Installing some nice tools is also easy:

    brew install htop
    

    To install a better alternative to the standard process viewer top.

  • Fix Magento 1.9.3 ‘Notice: Undefined index: session_expire_timestamp in … on line 461’

    Some days ago the Magento security update SUPEE-8788 was released. This update fixes a number of critical vulnerabilities. To fix an existing shop one could either apply the SUPEE-patch or upgrade the shop to Magento 1.9.3. However, after updating I experienced a little issue when trying to reach the shop again. 

    A PHP Exception popped up:

    Notice: Undefined index: session_expire_timestamp  in /data/web/public/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php on line 461
    

    Even after flushing the cache this problem appears. The undefined index and path of the file that raises the exception gives away that this problem might have to with Magento’s session handling. I started with deleting any existing session cookies in my browser. This made the error message disappear. Be aware that this is not an appropriate solution to this error!

  • Implementing a MATLAB digital filter or controllers in C++

    Controllers and filters are often a good way to stabilise a system, condition a signal or make a system follow a reference. The usual approach is to model the system or signal in an application like MATLAB and then design a filter or controller. Either by applying design rules, some sort of optimisation algorithm or tuning parameters experimentally. When the design is finished the controller or filter is not ready for use yet. It is still necessary to realise it in practice. This is often done digitally on a micro controller or real-time computer. This article will describe a effective, open and fast approach to realising a filter or controller in C++.

    See also the post about a more generic filtering and control library.

    Step responses of Butterworth Low-pass Filters
    Step responses of Butterworth Low-pass digital filters with different cut-off frequencies
  • Update Rooted Nexus 6P to Android 7.0 Nougat with FlashFire

    Android 7.0 is out! I’m really wondering about the split view mode and the new notification. I wanted to upgrade my Nexus 6P as soon as possible. The update was not available as an OTA for my phone yet so I had to take a simple measure to make it available. Furthermore my phone is rooted so I had to use a flash tool or the adb/fastboot tools to upgrade. First, we will enable the update. Then we download it. Next we use FlashFire to flash the firmware to the device (dangerous). Finally we will hopefully try to boot into the newest Android version.

    The steps below will most certainly work for all recent Nexus devices like the Nexus 6 and Nexus 5X. The older Nexus 5 is not supported officially so it will depend solely on community effort.

  • Running JIRA Software securely behind Apache with ISPConfig 3.1

    If you use both JIRA and ISPConfig on a server you might want to set-up a reverse proxy to serve the JIRA frontend securely on the standard HTTPS port just like other websites in your ISPConfig setup. ISPConfig uses Apache to serve websites whereas JIRA has its own web-server (Tomcat). It is not straight-forward to share a single port such as the HTTPS port 443 between two applications. The Apache Reverse-Proxy feature allows us to do so however.

    Secure JIRA using Apache Reverse-Proxy
    Secure JIRA using Apache Reverse-Proxy

    Advantages of using a reverse-proxy instead of serving JIRA on a different port are as follows:

    • Single entry-point for all web traffic
    • Access- and certificate management in one place (Apache via ISPConfig)
    • Only one or two (HTTP/HTTPS) ports need to be opened to the public
    • No need to specify the port when navigating to the JIRA instance
    • Allows traffic and statistics monitoring through Apache
  • Random Midpoint Displacement Fractal (RMDF)

    The Random Midpoint Displacement Fractal (RMDF) is a fractal this is often used for generating height-maps, landscapes, rough surfaces and more. Its implementation is simple but the results are interesting, especially when a nice color-map is applied to the matrix and it is shown as a 3D-surface.

    Example of a Random Midpoint Displacement Fractal

subscribe via RSS