Skip to content

Instantly share code, notes, and snippets.

View kmpm's full-sized avatar

Peter Magnusson kmpm

View GitHub Profile
@kmpm
kmpm / helper_apt.sh
Last active August 29, 2015 13:56
vagrant-ubuntu-precise
#!/bin/bash
echo '.. checking apt cache'
timestamp_file="$(mktemp)"
touch -d "$(date -R -d '1 day ago')" $timestamp_file
file=/var/lib/apt/periodic/update-success-stamp
if [ $file -ot $timestamp_file ]; then
echo '.. old apt cache'
apt-get update
apt-get upgrade -y
@kmpm
kmpm / wincommand.md
Created April 16, 2014 06:22
Windows Commands

Search for stuff in windows DHCP server

netsh dhcp server \ourdnsserver scope 192.168.1.0 show clients 1 | findstr raspberrypi

@kmpm
kmpm / esp8266_ubuntu.md
Last active August 29, 2015 14:13
esp8266

Chip to pin names

Pin 	Name 	    Description
1 	    GND 	    Ground
2 	    U0TXD 	    UART0 Transmit
3 	    GPIO2 	    Has internal pull-up
4 	    CHIP_EN 	Chip Enable, active high
5 	    GPIO0 	    Has internal pull-up
6 	    EXT_RSTB 	External reset signal, active low. Leave hanging
@kmpm
kmpm / document.kml
Created August 14, 2015 17:30
Depth map kml
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Folder>
<Document>
<name>svardlang</name>
<Style id="ISO:1m">
<PolyStyle>
<color>e60000cc</color>
<fill>true</fill>
<outline>false</outline>
@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 / 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 / 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 / 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