Skip to content

Instantly share code, notes, and snippets.

View Koronen's full-sized avatar

Victor Koronen Koronen

View GitHub Profile
@Koronen
Koronen / .gitignore
Created January 27, 2012 20:03
Roman Numerals
*.gem
.bundle
Gemfile.lock
pkg/*
@Koronen
Koronen / parse_data.rb
Created March 23, 2012 20:46
Parse Huawei 3G modem (unknown model) USB data
#!/usr/bin/env ruby
def main
ARGF.each do |line|
if line.match(%r{\^DSFLOWRPT})
parts = line[11..line.length].split(",")
a = parts[0].to_i(16) / (1.0 * 60 * 60) #uptime in s
b = parts[1].to_i(16) / (1.0 * 1024) # speed tx
c = parts[2].to_i(16) / (1.0 * 1024) # speed rx
d = parts[3].to_i(16) / (1.0 * 1024 * 1024) # total tx
@Koronen
Koronen / bootstrap_debian.sh
Created April 29, 2012 10:38
System bootstrap scripts
#!/bin/sh
set -e
# System update & upgrade
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
# Editor
@Koronen
Koronen / bootstrap-debian.sh
Created May 7, 2012 21:01
Simple Webcam Barcode Scanner
#!/bin/sh
set -e
sudo apt-get install zbar-tools xdotool
@Koronen
Koronen / bra.txt
Created October 27, 2012 16:49
progp12: S1
steve@apple.com
STEVE@microsoft.com
larry@oracle.com
arve+web@csc.kth.se
gudrun@min.privata.mejl.server.nu
a@hemlig.se
com@com.com
com-org@net.nu.se
abc!#$@just.nu
123*%/@ink.org
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define NR_OF_PLAYS (1000000)
#define BET (100)
#define PAYOFF (200)
#define MINIMUM_CERTAINTY (0.75)
@Koronen
Koronen / E.ans
Created December 9, 2012 19:46
encodedmessage
TOPSECRET
RosesAreRedVioletsAreBlue
SquaresMayBeEven
@Koronen
Koronen / install-update-configure-rbenv.sh
Last active December 14, 2015 03:49
Install and configure rbenv
#!/usr/bin/env sh
set -e
RBENV="$HOME/.rbenv"
# Clone/Update rbenv
[ -d "$RBENV" ] && ( cd "$RBENV"; git pull -q ) || \
git clone -q https://github.com/sstephenson/rbenv.git "$RBENV"
@Koronen
Koronen / Makefile
Created March 29, 2013 18:06
Merge and clean Nordea account statements
PK_CSV_FILES=$(wildcard **/personkonto_*.csv)
.PHONY: default clean
default: personkonto.csv
personkonto.csv: $(PK_CSV_FILES)
@echo '"Datum","Transaktion","Kategori","Belopp","Saldo"' > $@
@cat $^ | sed -n -e 's/"\?Datum"\?.\+//' \
-e 's/\.\([0-9][0-9][0-9]\)/\1/g' \
@Koronen
Koronen / csv2vcf.rb
Created May 30, 2013 09:25
A quick hack to convert a CSV table filled with contact details into a vCard.
#!/usr/bin/env ruby
require 'csv'
require 'erb'
def main
vcard_template = ERB.new(DATA.read)
CSV.parse(STDIN, headers: true).each do |row|
name = row['Namn']
email = row['Email']