Skip to content

Instantly share code, notes, and snippets.

View kmpm's full-sized avatar

Peter Magnusson kmpm

View GitHub Profile
@kmpm
kmpm / amqprpc.js
Created May 17, 2012 18:45
RPC over RabbitMQ/AMQP
var amqp = require('amqp')
, crypto = require('crypto')
var TIMEOUT=2000; //time to wait for response in ms
var CONTENT_TYPE='application/json';
var CONTENT_ENCODING='utf-8';
exports = module.exports = AmqpRpc;
function AmqpRpc(connection){
@kmpm
kmpm / lowfat-desktop
Created May 28, 2012 12:38
equivs-build control file that would give you a Ubuntu 12.04 desktop with very little extra fluff
Section: misc
Priority: optional
Homepage: https://gist.github.com/2818966
Standards-Version: 3.9.2
Package: lowfat-desktop
Version: 0.0.5~dev1
Maintainer: Peter Magnusson <kmpm@birchroad.net>
Depends: language-pack-en, libnl-3-200, libnl-genl-3-200, libnl-route-3-200,
acpi-support, branding-ubuntu, build-essential,unity-lens-applications,
@kmpm
kmpm / GitHub.PowerShell_profile.ps1
Created June 26, 2012 16:38
Personal github posh-git profile
# <My Documents>\WindowsPowershell\GitHub.PowerShell_profile.ps1
# If Posh-Git environment is defined, load it.
if (test-path env:posh_git) {
. $env:posh_git
}
# If module is installed in a default location ($env:PSModulePath),
# use this instead (see about_Modules for more information):
# Import-Module posh-git
@kmpm
kmpm / README.md
Last active June 13, 2019 21:01
OWFS on Raspberry Pi using i2c

OWFS on Raspberry PI using i2c

This is based on a default "wheezy" install.

Prepare

First, install all neccesary tools and some good to have ones. When this was written 2012-01-03 it wasn't neccesary to compile your own owfs. The one from the repositories work fine.

@echo off
SET VIMFILES="%userprofile%\vimfiles"
SET VIMRC="%userprofile%\.vimrc"
echo VIMFILES=%VIMFILES%
echo creating folders for pathogen
IF NOT EXIST %vimfiles%\autoload mkdir %vimfiles%\autoload
IF NOT EXIST %vimfiles%\bundle mkdir %vimfiles%\bundle
sudo apt-get install build-essential bison flex gperf texinfo gawk
sudo apt-get install debootstrap libtool autoconf automake libncurses5-dev

wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.18.0.tar.bz2
tar -jxf crosstool-ng-1.18.0.tar.bz2
cd crosstool-ng-1.18.0
@kmpm
kmpm / README.md
Created September 26, 2013 16:41
Node.js - Stuff to read
@kmpm
kmpm / b3-debian.md
Last active December 24, 2015 10:08

How to make life easier with BeagleBone Black

This is a set of notes and instructions that I use to get my BeagleBone Black to a state that I find usable after installing Debian Wheezy on it.

Neccesary things

sudo apt-get install git curl vim python build-essential openssl libssl-dev
@kmpm
kmpm / b3-ångström.md
Last active December 15, 2019 21:31
Ångström on BeagleBone Black

Prerequisite

  • Ubuntu 13.10 on a "ordinary" PC
  • A BeagleBone Black to deply to in the end

All estimated times here are based on the 2.5Ghz Core2Duo with 4GB RAM I did it on. If you update and rebuild it will probably take less.

@kmpm
kmpm / PdfFilterAttribute.cs
Created January 10, 2014 12:17
Filter for an MVC4 application to render all views as PDF if AcceptTypes contains "application/pdf" or querystring contains asPDF=1. Uses wkthml2pdf via Pechkin. Currently requires https://github.com/gmanny/Pechkin/pull/42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Text;
using System.IO;
using System.Web.UI;
using Pechkin;
using System.Text.RegularExpressions;