Skip to content

Instantly share code, notes, and snippets.

@marxjohnson
marxjohnson / evtest.log
Created August 18, 2014 17:22
evtest dump for wavebird controller X axis
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x1a34 product 0xf705 version 0x110
Input device name: "HuiJia USB GamePad"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 288 (BTN_TRIGGER)
Event code 289 (BTN_THUMB)
Event code 290 (BTN_THUMB2)
Event code 291 (BTN_TOP)
@marxjohnson
marxjohnson / post-record
Last active November 24, 2016 20:00
Post-record shutdown script for TVheadEnd/XBMC PVR
#!/bin/bash
ruby /usr/local/bin/post-record.rb >> /home/xbmc/wakeup.log 2>&1
@marxjohnson
marxjohnson / wakeup.sh
Created May 7, 2014 18:17
wakeup.sh for XBMC/TvHeadEnd PVR
#!/bin/bash
echo "Executing Wakeup Script" >> /home/xbmc/wakeup.log
echo $1 >> /home/xbmc/wakeup.log
echo 0 > /sys/class/rtc/rtc0/wakealarm
echo $1 > /sys/class/rtc/rtc0/wakealarm
cat /sys/class/rtc/rtc0/wakealarm >> /home/xbmc/wakeup.log
@marxjohnson
marxjohnson / hwclock-save.conf
Last active August 29, 2015 14:01
/etc/init/hwclock-save.conf for Ubuntu 12.04 with ACPI Wakealarm enabled
# hwclock-save - save system clock to hardware clock
#
# This task saves the time from the system clock back to the hardware
# clock on shutdown.
description "save system clock to hardware clock"
start on runlevel [06]
task
@marxjohnson
marxjohnson / post-record
Last active November 24, 2016 19:58
XBMC/Tvheadend post-record shutdown script
#!/usr/bin/env ruby
require 'net/http'
require 'json'
uri = URI 'http://localhost:8080/jsonrpc'
jsonrpc = Net::HTTP::Post.new uri
jsonrpc.add_field 'Content-Type', 'application/json'
jsonrpc.add_field 'Accept', 'application/json'
@marxjohnson
marxjohnson / gist:9311206
Created March 2, 2014 18:28
Outline of my Amazon/Lovefilm Instant Video-on-Ubuntu solution
Previous solution used Pipelight, which was much nicer. However, since Amazon ate Lovefilm, the player doesn't work with pipelight. So..
2 Profiles:
xbmc (XBMC session, auto login, no password)
lovefilm (Openbox session, no password)
Menu item in XBMC triggers session switch to Lovefilm (uses dm-tool)
On login, Lovefilm automatically launches Windows 7 VM in virtualbox, full screen, automatically logs in and runs Firefox fullscreen (or just loads saved state if there is one).
User watches stuff with silverlight. When finished, they close VirtualBox using "X" icon on pop-up menu bar.
When Virtualbox is closed, dm-tool is automatically invoked to return user to XBMC, and all remaining processes belonging to lovefilm are killed with pkill.
@marxjohnson
marxjohnson / gist:5856890
Last active December 18, 2015 22:48
PHP finally keyword
<?php
function throw_exception() {
// Arbitrary code here
throw new Exception('Hello, Joe!');
}
function some_code() {
// Arbitrary code here
}
@marxjohnson
marxjohnson / pagesnap.php
Created October 18, 2012 14:50 — forked from afiore/pagesnap
Save a webpage (and its linked assets) into a single HTML file.
#! /usr/bin/env php
<?php
/***
* PageSnap
*
* Script for archiving a HTML page (and associated media assets) into a single file.
*
* Requires:
*
@marxjohnson
marxjohnson / DrupalToWordpress.java
Created August 4, 2012 14:28
A tweaked version of a script from modeling-languages.com to convert Drupal 6 blog posts to Wordpress
/*
*
*
* Simple Drupal 6 to Wordpress 3 migrating class for the modeling-languages.com portal
*
*
* @version 0.1 10 June 2011
* @author Jordi Cabot
*
*
@marxjohnson
marxjohnson / 0051-Removed-requirement-from-city-and-country-fields-in-.patch
Created August 1, 2012 11:01
Patch for Moodle 2 to remove requirement from city and country fields in user profile. Copyright Richard Taunton Sixth Form College, UK. Licenced under GNU GPL.
From c106c6188887b169a237a2e14b675dab9e1aa777 Mon Sep 17 00:00:00 2001
From: Mark Johnson <mark.johnson@tauntons.ac.uk>
Date: Mon, 12 Sep 2011 13:46:00 +0100
Subject: [PATCH 51/78] Removed requirement from city and country fields in
user profile
---
user/editlib.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)