Skip to content

Instantly share code, notes, and snippets.

View matachi's full-sized avatar

Daniel Jonsson matachi

View GitHub Profile
@matachi
matachi / EncodeFloatAsByteArray.swift
Created November 12, 2018 09:23
Encode a Float as a UInt8 byte array in Swift.
extension Float {
/**
Converts the float to an array of UInt8.
With this method, it is possible to encode a float as bytes and later
unpack the bytes to a float again. Note though that some of the precision
is lost in the conversion.
For instance, a conversion of 0.75 with the maxRange 1.0 results in the
array `[233, 255, 255, 0]`. To convert the array back to a float, do the
@matachi
matachi / BytesToTexture.swift
Created November 12, 2018 08:21
Make an image from a byte array in Swift.
class BytesToTexture {
func texture(bytes: [UInt8], bytesPerRow: Int) -> CGImage {
let rgbaData = CFDataCreate(nil, bytes, bytes.count)!
let provider = CGDataProvider(data: rgbaData)!
let colorSpace = CGColorSpaceCreateDeviceRGB()
let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.noneSkipLast.rawValue)
return CGImage(
width: bytesPerRow / 4,
height: bytes.count / bytesPerRow,
bitsPerComponent: 8,
#!/usr/bin/env python3
import argparse
import os
import csv
from subprocess import Popen, PIPE
def get_file_name(base_name, depth=0):
name = '%s %d' % (base_name, depth) if depth > 0 else base_name
if os.path.exists(os.path.join(

Sub procedure

Sub AddEmUp()
    Sum = 1 + 1
    MsgBox "The answer is " & Sum
End Sub

Function procedures

Function AddTwo(arg1, arg2)

Mutt cheat sheet

Mail list

Movement

Key Action
j Move to the next undeleted entry.
k Move to the previous undeleted entry.

Should SPLE be started at all?

  • Big upfront investment
  • Reorganization, resistance, big change for a company

How will product line engineering impact our business performance?

  • What we will gain or lose

What products part of product line?

@matachi
matachi / Dockerfile
Created December 11, 2013 21:21
Install sshd and automatically start it when starting a container. For example: `sudo docker build -t test . && sudo docker run -t -i -p 1337:22 test`
FROM ubuntu
RUN apt-get update
RUN apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:pass' | chpasswd
CMD /usr/sbin/sshd && bash
#!/usr/bin/env python2
import requests
import tweepy
ACCESS_TOKEN = ''
ACCESS_TOKEN_SECRET = ''
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
TAGS = '#Python #Programming'
# Init completion
autoload -U compinit && compinit
compinit
# Init custom prompt
autoload promptinit
promptinit
# Init colors for prompt
autoload -U colors && colors