Skip to content

Instantly share code, notes, and snippets.

View anjackson's full-sized avatar
👾

Andy Jackson anjackson

👾
View GitHub Profile
@anjackson
anjackson / SwingFXWebView.java
Created January 19, 2012 15:41
Embedding a JavaFX WebView in a Swing panel.
import com.sun.javafx.application.PlatformImpl;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Node;
@anjackson
anjackson / gist:2888380
Created June 7, 2012 11:47
Making a Bottle app that routes to a proxy
import bottle
from wsgiproxy.app import WSGIProxyApp
# Remove "hop-by-hop" headers (as defined by RFC2613, Section 13)
# since they are not allowed by the WSGI standard.
FILTER_HEADERS = [
'Connection',
'Keep-Alive',
'Proxy-Authenticate',
'Proxy-Authorization',
@anjackson
anjackson / PDF Encryption test for .net
Created March 25, 2013 13:25
This shows the logic needed to test for two the different PDF encryption modes. It is written in C#, and has been tested with version 1.2.1 of PDFBox, cross-compiled to .net using IKVM (http://www.ikvm.net/).
Console.WriteLine("Document encrypted = {0}", document.isEncrypted().ToString());
// Can it be opened?
bool isOpenable = true;
if (document.isEncrypted())
{
DecryptionMaterial decryptionMaterial = new StandardDecryptionMaterial("");
try
{
document.openProtection(decryptionMaterial);
AccessPermission ap = document.getCurrentAccessPermission();
09:14:40.487 GET http://jsmess.textfiles.com/messloader.html [HTTP/1.1 304 Not Modified 190ms]
09:14:40.684 Error in parsing value for 'image-rendering'. Declaration dropped. messloader.html:10
09:14:40.684 Error in parsing value for 'image-rendering'. Declaration dropped. messloader.html:11
09:14:40.684 Error in parsing value for 'image-rendering'. Declaration dropped. messloader.html:12
09:14:40.684 Unknown pseudo-class or pseudo-element '-webkit-full-screen'. Ruleset ignored due to bad selector. messloader.html:20
09:14:41.048 GET http://jsmess.textfiles.com/html/a2600.html [HTTP/1.1 404 Not Found 93ms]
09:14:41.049 GET http://jsmess.textfiles.com/gamehtml/Jrpacman.bin.html [HTTP/1.1 404 Not Found 185ms]
09:14:40.845 NS_ERROR_NOT_AVAILABLE: jsmess-loader.js:41
09:14:41.189 SyntaxError: illegal character messloader.html
@anjackson
anjackson / cvs2git.options
Created March 11, 2014 11:34
Scripts and config for moving JHOVE from SourceForge CVS to GitHub
# (Be in -*- mode: python; coding: utf-8 -*- mode.)
#
# ====================================================================
# Copyright (c) 2006-2010 CollabNet. All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://subversion.tigris.org/license-1.html.
# If newer versions of this license are posted there, you may use a
# newer version instead, at your option.
@anjackson
anjackson / DROID application.msword generators
Created March 17, 2014 15:38
Comparison of software generator results
{
"responseHeader":{
"status":0,
"QTime":55,
"params":{
"facet":"true",
"indent":"true",
"q":"content_type_droid:application/msword*",
"facet.field":"generator",
"wt":"json",
.;=-
"NNMMMMMM$A!
;BMMMMMMMMMMMMR%
;MMMMMMMMMMMMMMMMC
#MMMMMMMMMMMMMMMMM
@anjackson
anjackson / drupal-authentication.php
Created August 20, 2014 10:00
Script to bootstrap and authenticate against Drupal, for Apache mod_auth_external.
#!/usr/bin/php
<?php
# Globals to hold status:
$drupal_bootstrapped = FALSE;
$authenticated = FALSE;
# Use a shutdown function to ensure that authentication does not go through
# if bootstrapping Drupal fails (because PHP's die() returns exit(0)):
function shutdown() {
@anjackson
anjackson / sample3.wav.jhove2.log
Created August 21, 2014 11:05
jhove2 src/test/resources/wave/sample3.wav | grep -v "TypeConverterDelegate" > sample3.wav.jhove2.log
FileSource:
StartingOffset (byte): 0
EndingOffset (byte): 95
Size (byte): 96
FileSystemProperties:
Path: /Users/andy/Documents/workspace/jhove/src/test/resources/wave/sample3.wav
LastModified: 2014-08-21T10:20:13+01:00
PresumptiveFormats:
PresumptiveFormat {FormatIdentification}:
NativeIdentifier {I8R}:
@anjackson
anjackson / gist:e2e22bd847b14517e5b0
Created September 8, 2014 10:26
Tika 1.6 version support
$ tika -m ~/Downloads/Sample\ 10.x.pdf
Content-Length: 5994
Content-Type: application/pdf
Creation-Date: 2014-03-04T20:56:45Z
Last-Modified: 2014-03-04T21:14:56Z
Last-Save-Date: 2014-03-04T21:14:56Z
X-Parsed-By: org.apache.tika.parser.DefaultParser
X-Parsed-By: org.apache.tika.parser.pdf.PDFParser
created: Tue Mar 04 20:56:45 GMT 2014
date: 2014-03-04T21:14:56Z