Skip to content

Instantly share code, notes, and snippets.

View phuysmans's full-sized avatar

Philippe Huysmans phuysmans

View GitHub Profile
@phuysmans
phuysmans / annotator-example-plugin.js
Created May 26, 2020 15:01 — forked from itskingori/annotator-example-plugin.js
Example AnnotatorJS Plugin showing events
Annotator.Plugin.Example = function (element, options) {
var myPlugin = {};
myPlugin.pluginInit = function () {
// This annotator instance
this.annotator
// LOADING
.subscribe("annotationsLoaded", function (annotations) {
console.log("annotationsLoaded called when the annotations have been loaded.");
console.log(annotations);
@phuysmans
phuysmans / portable-zip-pathnames.ps1
Created May 7, 2020 09:14 — forked from lantrix/portable-zip-pathnames.ps1
PowerShell encoding Zip paths to use forward slash (Zip Spec) instead of backslash (Windows Style); for portable zip files - thanks to @sethjackson
# When using System.IO.Compression.ZipFile.CreateFromDirectory in PowerShell, it still uses backslashes in the zip paths
# despite this https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/mitigation-ziparchiveentry-fullname-path-separator
# Based upon post by Seth Jackson https://sethjackson.github.io/2016/12/17/path-separators/
#
# PowerShell 5 (WMF5) & 6
# Using class Keyword https://msdn.microsoft.com/powershell/reference/5.1/Microsoft.PowerShell.Core/about/about_Classes
#
@phuysmans
phuysmans / run.bat
Created May 7, 2020 08:00 — forked from thinkerbot/run.bat
Execute a powershell script via ssh
# Notes:
# 1) The input format must be specified to prevent ssh from hanging
# 2) The full path to the script is required
# 3) An SSH server must be running on the Windows box, naturally. WinSSHD
# is free for personal, non-commercial use and worked for this example.
# See http://www.bitvise.com/winsshd
#
# You have to set the execution policy for scripts so that powershell has
# permissions to run the script. To do so, search for 'Powershell' under
# the Start menu. Then right-click and 'Run as administrator' so that you
// polyfill window.getMatchedCSSRules() in FireFox 6+
if ( typeof window.getMatchedCSSRules !== 'function' ) {
var ELEMENT_RE = /[\w-]+/g,
ID_RE = /#[\w-]+/g,
CLASS_RE = /\.[\w-]+/g,
ATTR_RE = /\[[^\]]+\]/g,
// :not() pseudo-class does not add to specificity, but its content does as if it was outside it
PSEUDO_CLASSES_RE = /\:(?!not)[\w-]+(\(.*\))?/g,
PSEUDO_ELEMENTS_RE = /\:\:?(after|before|first-letter|first-line|selection)/g;
// convert an array-like object to array
@phuysmans
phuysmans / mozGetMatchedCSSRules.js
Created March 27, 2020 10:53 — forked from ydaniv/mozGetMatchedCSSRules.js
A Gecko only polyfill for Webkit's window.getMatchedCSSRules
// polyfill window.getMatchedCSSRules() in FireFox 6+
if ( typeof window.getMatchedCSSRules !== 'function' ) {
var ELEMENT_RE = /[\w-]+/g,
ID_RE = /#[\w-]+/g,
CLASS_RE = /\.[\w-]+/g,
ATTR_RE = /\[[^\]]+\]/g,
// :not() pseudo-class does not add to specificity, but its content does as if it was outside it
PSEUDO_CLASSES_RE = /\:(?!not)[\w-]+(\(.*\))?/g,
PSEUDO_ELEMENTS_RE = /\:\:?(after|before|first-letter|first-line|selection)/g;
// convert an array-like object to array
@phuysmans
phuysmans / mozGetMatchedCSSRules.js
Created March 27, 2020 10:53 — forked from darrnshn/mozGetMatchedCSSRules.js
A Blink only polyfill for Webkit's window.getMatchedCSSRules
// polyfill window.getMatchedCSSRules() in Chrome
if ( typeof window.getMatchedCSSRules !== 'function' ) {
var ELEMENT_RE = /[\w-]+/g,
ID_RE = /#[\w-]+/g,
CLASS_RE = /\.[\w-]+/g,
ATTR_RE = /\[[^\]]+\]/g,
// :not() pseudo-class does not add to specificity, but its content does as if it was outside it
PSEUDO_CLASSES_RE = /\:(?!not)[\w-]+(\(.*\))?/g,
PSEUDO_ELEMENTS_RE = /\:\:?(after|before|first-letter|first-line|selection)/g;
// convert an array-like object to array
@phuysmans
phuysmans / fritzbox-cert-update.sh
Created August 8, 2019 08:37 — forked from wikrie/fritzbox-cert-update.sh
Fritzbox Fritz!Box AVM SSL Letsencrypt automatically update
#!/bin/bash
# parameters
USERNAME="maybe empty"
PASSWORD="fritzbox-password"
CERTPATH="path to cert eg /etc/letsencrypt/live/domain.tld/"
CERTPASSWORD="cert password if needed"
HOST=http://fritz.box
# make and secure a temporary file
#determine the labels
import pyvw #vw python interface
DEST = 1
PROP = 2
FAC = 3
...
#create the class for the Sequence Labeler
class SequenceLabeler(pyvw.SearchTask):
@phuysmans
phuysmans / i3config
Created February 4, 2019 08:54 — forked from NeoTheFox/i3config
My daily i3 config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@phuysmans
phuysmans / dawg.py
Created June 18, 2018 08:24 — forked from smhanov/dawg.py
Use a DAWG as a map
#!/usr/bin/python3
# By Steve Hanov, 2011. Released to the public domain.
# Please see http://stevehanov.ca/blog/index.php?id=115 for the accompanying article.
#
# Based on Daciuk, Jan, et al. "Incremental construction of minimal acyclic finite-state automata."
# Computational linguistics 26.1 (2000): 3-16.
#
# Updated 2014 to use DAWG as a mapping; see
# Kowaltowski, T.; CL. Lucchesi (1993), "Applications of finite automata representing large vocabularies",
# Software-Practice and Experience 1993