Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View kmpm's full-sized avatar

Peter Magnusson kmpm

View GitHub Profile
@kmpm
kmpm / fixvim.sh
Created December 29, 2010 16:44
Script to get a basic setup of vim for python on ubuntu
#!/usr/bin/env bash
# This file fairly close follows the recommendations in
# http://dancingpenguinsoflight.com/2009/02/python-and-vim-make-your-own-ide/
#
#MIT/Expat License
#Copyright (C) 2010 by Peter Magnusson <peter[at]birchroad.net>
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
@kmpm
kmpm / mongosquid.py
Created April 27, 2011 13:51
Squid to Mongo script
#!/usr/bin/env python
import pymongo,sys
#
# Really lame script to learn the pymongo APIs
# mdfranz@gmail.com
#
logfile = "/var/log/squid/access.log"
@kmpm
kmpm / pylink.sh
Created April 28, 2011 11:51 — forked from zvoase/pylink.sh
pylink - Link and unlink Python modules to your site packages directory.
@kmpm
kmpm / main.pde
Created August 20, 2011 16:30
Spjällstyrning
//Om du ändrar kortet så byt pinnarna
#define TRIGGER_PIN 5
#define BUTTON1_PIN 4
#define LED1_PIN 3
#define LED2_PIN 2 //används inte just nu
#define CTRL_ENABLE1_PIN 6 //aktiverar motordrivaren
#define CTRL_INPUT1_PIN 7 //rikning1 för motor
#define CTRL_INPUT2_PIN 8 //rikting2 för motor
@kmpm
kmpm / fabfile.py
Created September 8, 2011 15:22
Fabric deployment of Node.js on Ubuntu
from __future__ import with_statement
from fabric.api import env
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib.project import upload_project
import ubuntu
import protobuf
@kmpm
kmpm / map_reduce_stddev.js
Created September 12, 2011 16:41 — forked from dmitryame/Calculate standard deviation in mongo
mongo db Standard deviation calculation with map reduce using the Welford algoritm.
/*
* (The MIT License)
*
* Copyright (c) 2011 Peter Magnusson &lt;kmpm@birchroad.net&gt;
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
@kmpm
kmpm / norminv.js
Last active March 17, 2022 16:00
Compute the quantile function for the normal distribution. - like Excel NORMINV
/// Original C++ implementation found at http://www.wilmott.com/messageview.cfm?catid=10&threadid=38771
/// C# implementation found at http://weblogs.asp.net/esanchez/archive/2010/07/29/a-quick-and-dirty-implementation-of-excel-norminv-function-in-c.aspx
/*
* Compute the quantile function for the normal distribution.
*
* For small to moderate probabilities, algorithm referenced
* below is used to obtain an initial approximation which is
* polished with a final Newton step.
*
* For very large arguments, an algorithm of Wichura is used.
@kmpm
kmpm / minecraft_installer.sh
Created November 6, 2011 09:39
Ubuntu Minecraft Installation script
#!/bin/bash
# Alloc's Minecraft Installer:
# feel free to change, update, improve, and release this script
# suggestions of feedback? reach me at alloc@dr.com
# This script, in no way, is directly distributing any protected minecraft files
#!/bin/bash
#### wget -qO- http://goo.gl/kmNvU | sh
sudo aptitude install -y git
git clone git://gist.github.com/1501928.git gist-1501928
cd gist-1501928
git pull origin master
chmod +x *.sh
@kmpm
kmpm / makeit.sh
Created April 20, 2012 11:09
Install Ubuntu Core to a sda1
#!/bin/bash
#******************************************************
# A small script to help out install a Ubuntu Core
# Using a Live USB Ubuntu onto a HD
#
#******************************************************
# Copyright (c) 2012 Peter Magnusson <peter@birchroad.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal in