Skip to content

Instantly share code, notes, and snippets.

@rschroll
rschroll / applist.py
Last active August 29, 2015 13:56
A script to browse the Ubuntu Touch apps
#!/usr/bin/env python
# A basic Python script to let you browse the apps available in the
# Ubuntu Touch App store. Run it and your web browser should open.
#
# Copyright 2014 Robert Schroll
#
# 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
@rschroll
rschroll / dialog-test.qml
Created July 3, 2014 16:16
Demonstrating problems with Dialog sizing in the Ubuntu toolkit
/* Copyright 2013 Robert Schroll
*
* This file is part of Beru and is distributed under the terms of
* the GPL. See the file COPYING for full details.
*/
import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.ListItems 0.1
import Ubuntu.Components.Popups 0.1
@rschroll
rschroll / oxide-test.html
Created July 10, 2014 18:30
Communicating with an Oxide WebView
<html>
<head>
<script>
document.addEventListener("QMLmessage", function (event) {
document.body.innerHTML += "<p>Message received. You said " + event.detail.greeting + "</p>";
});
</script>
</head>
<body>
import QtQuick 2.0
import Ubuntu.Components 0.1
MainView {
// objectName for functional testing purposes (autopilot-qt5)
objectName: "mainView"
// Note! applicationName needs to match the "name" field of the click manifest
applicationName: "com.ubuntu.developer.username.panel-test"
@rschroll
rschroll / render.vala
Created March 3, 2015 16:41
PDF rendering timing test
// valac render.vala --pkg gtk+-3.0 --pkg poppler-glib
const int WIDTH = 1920;
const int HEIGHT = 1080;
public int main(string[] args) {
if (args.length != 2)
error("Must specify name of PDF file as argument");
File file = File.new_for_commandline_arg(args[1]);
@rschroll
rschroll / autosave
Created August 18, 2015 19:31
autosave after std dev of non-chunked data
{"changes":[["16c0991e-8e0d-4366-a9b2-c05307f312af",["43819319-177b-485f-b90e-fe50fe353d3d","e7f0d874-feb5-49ce-8d31-d7c0e749703f"],[["Aaron Bruno","1868970"],["Adam Levine","192151"],["Aino Jawo","2010943"],["Al Anderson","21764"],["Alan Wilder","2725"],["Alec John Such","124541"],["Alex Tanas","3747648"],["Alex Turner","391170"],["Alvin \"Seeco\" Patterson","21764"],["Andrew Brown","784074"],["Andrew Dost","1871196"],["Andrew Fletcher","2725"],["Andrew Hurley","318185"],["Andrew Phillips","1106902"],["Andy Nicholson","391170"],["Ashton Irwin","3750880"],["Aston \"Family Man\" Barrett","21764"],["Axel Hedfors","1801598"],["Ben Lovett","1567405"],["Ben McKee","2727700"],["Ben Spivak","3747648"],["Bernard \"Touter\" Harvey","21764"],["Bernie Leadon","255680"],["Bill Wyman","20991"],["Bob Marley","21764"],["Brent Kutzle","784074"],["Brian Jones","20991"],["Brian Kelley","3042765"],["Calum Hood","3750880"],["Carlton Barrett","21764"],["Caroline Hjelt","2010943"],["Chad Vaccarino","3601005"],["Charles Kelley","13
@rschroll
rschroll / autosave
Created August 18, 2015 19:34
autosave after crash due to NaN in std dev data
{"changes":[["16c0991e-8e0d-4366-a9b2-c05307f312af",["43819319-177b-485f-b90e-fe50fe353d3d","e7f0d874-feb5-49ce-8d31-d7c0e749703f"],[["Aaron Bruno","1868970"],["Adam Levine","192151"],["Aino Jawo","2010943"],["Al Anderson","21764"],["Alan Wilder","2725"],["Alec John Such","124541"],["Alex Tanas","3747648"],["Alex Turner","391170"],["Alvin \"Seeco\" Patterson","21764"],["Andrew Brown","784074"],["Andrew Dost","1871196"],["Andrew Fletcher","2725"],["Andrew Hurley","318185"],["Andrew Phillips","1106902"],["Andy Nicholson","391170"],["Ashton Irwin","3750880"],["Aston \"Family Man\" Barrett","21764"],["Axel Hedfors","1801598"],["Ben Lovett","1567405"],["Ben McKee","2727700"],["Ben Spivak","3747648"],["Bernard \"Touter\" Harvey","21764"],["Bernie Leadon","255680"],["Bill Wyman","20991"],["Bob Marley","21764"],["Brent Kutzle","784074"],["Brian Jones","20991"],["Brian Kelley","3042765"],["Calum Hood","3750880"],["Carlton Barrett","21764"],["Caroline Hjelt","2010943"],["Chad Vaccarino","3601005"],["Charles Kelley","13
@rschroll
rschroll / autosave
Created August 20, 2015 20:21
Bad index crash
{"changes":[["field",["field: view","field: field","field: kind"],[["e352de5d-b8c0-45bd-be77-b52d03f1215b","ac31178f-bfbf-4c2d-a44b-1681114926b3","output"]],[]],["tag",["tag: view","tag: tag"],[["e352de5d-b8c0-45bd-be77-b52d03f1215b","editor"]],[]],["display name",["display name: id","display name: name"],[["e352de5d-b8c0-45bd-be77-b52d03f1215b","New table!"],["ac31178f-bfbf-4c2d-a44b-1681114926b3","Field A"]],[]],["view",["view: view","view: kind"],[["e352de5d-b8c0-45bd-be77-b52d03f1215b","table"]],[]],["display order",["display order: id","display order: priority"],[["ac31178f-bfbf-4c2d-a44b-1681114926b3",-1]],[]]],"commands":[]}
{"changes":[["display name",["display name: id","display name: name"],[["ac31178f-bfbf-4c2d-a44b-1681114926b3","This is a field"]],[["ac31178f-bfbf-4c2d-a44b-1681114926b3","Field A"]]]],"commands":[]}
{"changes":[["e352de5d-b8c0-45bd-be77-b52d03f1215b",["ac31178f-bfbf-4c2d-a44b-1681114926b3"],[["This is the data"]],[]]],"commands":[]}
{"changes":[["display name",["display name: id"
@rschroll
rschroll / gist:2221668
Created March 28, 2012 00:06
Delayed resize of sidebar widgets in Reinteract
import gobject as _gobject
class _ResizeBox(_gtk.VBox):
def __init__(self, figure):
_gtk.VBox.__init__(self)
self.figure = figure
# Rounding errors slowly accumlate in the figure height, shrinking it down
# over time. So we make a copy here and use that to keep resetting the
# canvas to the proper size.
@rschroll
rschroll / highlightedtext.py
Created June 16, 2012 23:05
Decoding #pdfloc for highlighted text in the Sony PRS-T1
#!/usr/bin/env python
"""
%s mount-point
Print to a file information on the highlighted text of a selected file on
the reader at mount-point. The output file is tab-separated data of the
form:
page highlight-range mark-start mark-end mark-type marked-text
mark-start and mark-end are the 'pdfloc' data defining where the marked