Skip to content

Instantly share code, notes, and snippets.

@canthony
canthony / uk_sculpt_keyboard.json
Created May 18, 2018 09:10
Karabiner Elements config for mapping a Microsoft Sculpt Keyboard with UK Layout, with exceptions for MS Remote Desktop. Maps backslash (\), pipe (|), backtick/backquote (`) , quote ("), tilde (~) and hash/pound (#)
{
"title": "UK MS Sculpt Keyboard (Exceptions for MS Remote Desktop)",
"rules": [
{
"description": "Backslash ",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "non_us_backslash",
@canthony
canthony / zfs-recursive-restore.sh
Created March 3, 2017 08:58
zfs snapshot allows us to take recursive snapshots of a file system (zfs snapshot -r root-pool-name@snapshot). zfs rollback does *not* allow you to restore recursively. This script does; as the comment says, ideas copied from elsewhere and then rewritten into something I could read and maintain a little better. Not a lot, but a little.
#!/usr/bin/env bash
# Originally by: Dr. Martin Menzel www.dr-menzel-it.de
# Modified by Matthew Pherigo https://gist.github.com/mwpher/4493681e9efdcc271830
# Rewritten by Charles Anthony
#
# Recursively restores the zfs filesystems below a given filesystem to a snapshot
# e.g. given
# the-pool
# the-pool/var
# the-pool/var/lib
@canthony
canthony / catalina info.log
Created September 16, 2015 07:42
Orbeon on Tomcat 7
c:\java\apache-tomcat-7.0.64-orbeon>bin\catalina.bat version
Using CATALINA_BASE: "c:\java\apache-tomcat-7.0.64-orbeon"
Using CATALINA_HOME: "c:\java\apache-tomcat-7.0.64-orbeon"
Using CATALINA_TMPDIR: "c:\java\apache-tomcat-7.0.64-orbeon\temp"
Using JRE_HOME: "C:\java\jdk\jdk1.7.0_71-64"
Using CLASSPATH: "c:\java\apache-tomcat-7.0.64-orbeon\bin\bootstrap.jar;c:\java\apache-tomcat-7.0.64-orbeon\bin\tomcat-juli.jar"
Server version: Apache Tomcat/7.0.64
Server built: Aug 19 2015 17:18:06 UTC
Server number: 7.0.64.0
OS Name: Windows 7
@canthony
canthony / catalina version info.log
Last active September 16, 2015 07:43
Orbeon on Tomcat 8
c:\java\apache-tomcat-8.0.26>bin\catalina.bat version
Using CATALINA_BASE: "c:\java\apache-tomcat-8.0.26"
Using CATALINA_HOME: "c:\java\apache-tomcat-8.0.26"
Using CATALINA_TMPDIR: "c:\java\apache-tomcat-8.0.26\temp"
Using JRE_HOME: "C:\java\jdk\jdk1.7.0_71-64"
Using CLASSPATH: "c:\java\apache-tomcat-8.0.26\bin\bootstrap.jar;c:\java\apache-tomcat-8.0.26\bin\tomcat-juli.jar"
Server version: Apache Tomcat/8.0.26
Server built: Aug 18 2015 11:38:37 UTC
Server number: 8.0.26.0
@canthony
canthony / TableCheckBoxUI.java
Created October 16, 2013 11:03
Generated CheckBox column reflects the table selection. Selecting a table row set's the checkbox to checked. Deslecting a row sets the checkbox column to unchecked. Toggling the checkbox selects/deselcts the row. A bit ugly, frankly, but it works.
package uk.org.backstage;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.data.Property;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.AbstractSelect;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Table;
@canthony
canthony / ExampleTableEditingUI.java
Created September 23, 2013 11:45
An example of In-Place table editing, with Buffered edits (i.e. commit/discard) Select a row and click edit (or double click a row) to edit a row. Make changes, and either click "Save" or "Cancel" to store those changes to the underlying item. "Enter" and "Escape" are keyboard shortcuts for Save and Cancel. Code is far from elegant - just illust…
package uk.org.backstage;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.data.Container;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.event.ItemClickEvent;
import com.vaadin.event.ShortcutAction;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Button;
@canthony
canthony / AutoNumericExtension.java
Last active December 19, 2015 09:29
Snippets of a simple Vaadn 7 component extension that should ensure numeric-only characters entered in a text field, using jQuery + the autoNumeric jQuery plugin. autoNumeric is very flexible - I haven't done any configuration, but it's not very difficult to do.
/**
* An extension used to configure a TextField to allow only numbers, using the autoNumeric jQuery plugin.
*
* Proof of concept, really : have not implemented any server side configuration.
* <p/>
*
* @author Charles
* @see <a href="http://www.decorplanit.com/plugin">autoNumeric site</a>
* @see <a href="https://jquery.org">jQuery site</a>
*/
@canthony
canthony / CSVFileApplication.java
Created September 6, 2012 12:47
Vaadin : Reading an uploaded CSV File and using it to populate a Container/Table
package org.backstage;
import au.com.bytecode.opencsv.CSVReader;
import com.vaadin.Application;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.ui.Table;
import com.vaadin.ui.Upload;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
@canthony
canthony / TestApp.java
Created August 16, 2012 07:03
Vaadin : how to override Table#formatPropertyValue(Object, Object, Property)
public class TestApp extends Application {
public void init() {
Window mainWindow = new TestWindow();
setMainWindow(mainWindow);
}
public class TestWindow extends Window {
public TestWindow() {
IndexedContainer container = createContainer();
Table table = createTable(container);
@canthony
canthony / TestApp.java
Created July 24, 2012 10:31
Shows use of a Vaadin Table Generator
package com.example;
import com.vaadin.Application;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.terminal.ExternalResource;
import com.vaadin.ui.Embedded;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;