Skip to content

Instantly share code, notes, and snippets.

View reinvented's full-sized avatar

Peter Rukavina reinvented

View GitHub Profile
@reinvented
reinvented / backtitude-server.php
Created August 20, 2014 20:23
A small PHP script that can act as the server-side for the Androind geolocation-tracking app Backtitude.
<?php
$mysqli = new mysqli("localhost", "loc", "[password redacted]", "loc");
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
if ($_POST) {
@reinvented
reinvented / amr.py
Last active August 29, 2015 14:06
TIny script to log data from a Grid Insight AMRUSB-1
#!/usr/bin/env python
import serial, sys
from time import strftime
print "Connecting to AMRUSB-1. Press Control+C to abort."
logfilename = 'amrusb-1-' + strftime("%Y%m%d%H%M%S") + 'log'
f = open(logfilename, 'w')

Keybase proof

I hereby claim:

  • I am reinvented on github.
  • I am ruk (https://keybase.io/ruk) on keybase.
  • I have a public key whose fingerprint is F117 16C2 357E E5D8 2DC8 55F2 3216 C283 73AE D00F

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reinvented
reinvented / pei-vcard-shim.js
Created November 24, 2011 15:10
Beginnings of a node.js script to act as a web search to LDAP shim
// https://github.com/mattt/vcard.js
require('./vcard.js');
// https://github.com/silentrob/Apricot
var Apricot = require('apricot').Apricot;
// http://nodejs.org/docs/latest/api/http.html
var http = require('http');
// http://nodejs.org/docs/latest/api/util.html
@reinvented
reinvented / SubjectFilter.scpt
Created December 14, 2011 19:19
Applescript to test length of incoming mail's Subject line and reply with a warning for short subject.
on perform_mail_action(info)
-- Definition of a Carriage Return. You don't need to change this.
set crlf to (ASCII character 13) & (ASCII character 10) & (ASCII character 13) & (ASCII character 10)
-- My name is… (set to your own first name; it's used at the end of the email)
set myName to "Peter"
-- The first part of the automatic reply to be sent... you want to customize this. The sender's subject gets tacked on the end.
set theReplyOne to "Hi there," & crlf & "You recently sent me an email message with the very short subject of '"
@reinvented
reinvented / energy-nabaztag.php
Created January 3, 2012 21:17
Send PEI Energy Interchange report to a Nabaztag rabbit
<?php
$apiKey = "get this from nabaztag.com";
$localDir = "/www/htdocs-ruk/nabaztag/wav";
$webDir = "http://media.ruk.ca/nabaztag/wav";
$id = uniqid();
$nbso = simplexml_load_file("http://energy.reinvented.net/pei-energy/nbso/get-nbso-data.php?format=xml");
$message = "P E I energy interchange is " . $nbso->PEI . " megawatts";
system("/usr/local/bin/swift \"" . escapeshellarg($message) . "\" -o $localDir/$id.wav");
$fp = fopen("http://www.nabalive.com/nabaztags/$apiKey/play?url=" . urlencode("$webDir/$id.wav"),"r");
?>
@reinvented
reinvented / create-trac-ticket.php
Created November 4, 2012 15:32
PHP script to use as a target for Postmark Inbound webhooks to create Trac tickets
<?php
include 'Mail.php';
include 'Mail/mime.php' ;
define("MAIL_MIME_CRLF","\r\n");
$json = file_get_contents('php://input');
$email = json_decode($json);
@reinvented
reinvented / send-trac-ticket.applescript
Created November 5, 2012 19:19
An AppleScript to use with Alfred.app to create a new Trac ticket by email
on alfred_script(q)
tell application "Mail"
set myMessage to make new outgoing message with properties {visible:true, subject: q}
set message signature of myMessage to signature "trac"
tell myMessage
make new to recipient with properties {name:"Trac", address:"ticket@example.com"}
end tell
activate
end tell
end alfred_script
@reinvented
reinvented / leave-the-office.scpt
Created November 26, 2012 18:45
AppleScript to sign off Adium and Skype, close Bria and stop Rdio.
tell application "Rdio" to pause
tell application "Adium" to go away
tell application "Skype"
send command "SET PROFILE MOOD_TEXT " & "Left office at " & time string of (current date) script name "Phidgets"
send command "SET USERSTATUS OFFLINE" script name "Phidgets"
end tell
tell application "Bria 3"
quit
end tell