Skip to content

Instantly share code, notes, and snippets.

View plopp's full-sized avatar

Marcus Kempe plopp

View GitHub Profile
@plopp
plopp / LICENSE
Last active August 29, 2015 14:15 — forked from jdp/LICENSE
Copyright (C) 2012 Justin Poliey <justin.d.poliey@gmail.com>
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 permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WIT
@plopp
plopp / sketch.ino
Created November 24, 2015 15:17
Thread Particle.io - Controlling a stepper motor with a wheel on it.
// This #include statement was automatically added by the Particle IDE.
#include "SparkJson/SparkJson.h"
//Includes
#include "MQTT/MQTT.h"
#include "math.h"
//Defines
#define STEPS 200
#define ADCwidth 12
@plopp
plopp / process1
Created February 2, 2016 21:41
Python script init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: process1
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon process1 at boot time
# Description: Enable service provided by daemon process1.
### END INIT INFO
@plopp
plopp / sweref2wgs84
Created April 27, 2016 21:14
Sweref99 to WGS84 conversion in javascript test
// Author: Arnold Andreasson, info@mellifica.se
// Copyright (c) 2007-2016 Arnold Andreasson
// License: MIT License as follows:
//
// 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 permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@plopp
plopp / ntp2timestamp.py
Created July 8, 2016 16:32
Calls an NTP server and converts the response to a millisecond unix epoch timestamp
import socket
import struct
import time
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
data = '\x1b' + 47 * '\0'
client.sendto(data, ("0.se.pool.ntp.org",123))
data, address = client.recvfrom( 1024 )
if data:
def twosComplement(val, nbits):
n = (2**nbits)
if(val > (n/2-1)):
return val-n
else:
return val
print twosComplement(64123,16)
import xlsxwriter
import sys
#### Kvicksundspokalen parser
#Parse file
#Extract fields
#Sort by date?
#Format xml output
#Add to sheet
#Create an new Excel file and add a worksheet.
#include <Sodaq_RN2483.h>
#include <Sodaq_wdt.h>
#include <StringLiterals.h>
#include <Switchable_Device.h>
#include <Utils.h>
/* Docs
Commands reference RN2483 - http://ww1.microchip.com/downloads/en/DeviceDoc/40001784B.pdf
RN2483 in general - http://www.microchip.com/wwwproducts/en/RN2483
*/
import logging
import time
from logging.handlers import TimedRotatingFileHandler
#----------------------------------------------------------------------
def create_timed_rotating_log(path):
""""""
logger = logging.getLogger("Rotating Log")
logger.setLevel(logging.INFO)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.