Skip to content

Instantly share code, notes, and snippets.

@peta
peta / myvm.vmx
Last active August 29, 2015 13:57
Virtual network settings of VMware virtual machine container (VMX-file)
ethernetX.present = "TRUE"
ethernetX.connectionType = "nat"
ethernetX.addressType = "generated"
ethernetX.startConnected = "TRUE"
ethernetX.generatedAddressOffset = "0"
ethernetX.virtualDev = "e1000"
ethernetX.wakeOnPcktRcv = "FALSE"
ethernetX.linkStatePropagation.enable = "FALSE"
ethernetX.vnet = "vmnetX"
ethernetX.bsdName = "en0"
@peta
peta / generate-routes.xsl
Last active December 20, 2015 13:39
Converter script used to split a huge KML file (as produced by Google Maps Engine Light) that contains lots of independent line segments into separate route files.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.opengis.net/kml/2.2"
xpath-default-namespace="http://www.opengis.net/kml/2.2"
exclude-result-prefixes="xs"
version="2.0">
<xsl:param name="output-dir"/>
<xsl:variable name="doc-name" select="/kml/Document/name[1]"/>
@peta
peta / fm4-grabber.rb
Last active June 25, 2020 20:25
Die Jungs von ORF/FM4/APA haben offenbar den Publishingworkflow und die Integration der FM4oD Mitschnitte auf fm4.orf.at überarbeitet -- und somit mein altbewährtes Grabber-Bashskript unbrauchbar gemacht. Die neue Lösung ist etwas komplexer, weswegen ich das Skript auch mit Ruby anstatt Bash umgesetzt habe, aber funktioniert dennoch gewohnt zuve…
#!/usr/bin/env ruby
# encoding: UTF-8
require 'uri'
require 'open-uri'
require 'json'
require 'nokogiri'
class PodcastGrabber
@peta
peta / editor_plugin.js
Created April 21, 2013 20:14
Two tiny improvements to the codecolorer-tinymce-button WordPress plugin. 1) Add support for N3 syntax highlighter 2) add inline option to TinyMCE window
// Docu : http://wiki.moxiecode.com/index.php/TinyMCE:Create_plugin/3.x#Creating_your_own_plugins
(function() {
// Load plugin specific language pack
tinymce.PluginManager.requireLangPack('cctb');
tinymce.create('tinymce.plugins.cctb', {
init : function(ed, url) {
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
#!/usr/bin/env ruby
# encoding: utf-8
require 'rdf'
require 'rdf/turtle'
require 'sparql'
graph = RDF::Graph.new 'urn:graph1'
reader = RDF::Turtle::Reader.new <<'TTL'
@prefix ex: <urn:example#>.
@peta
peta / dokuwiki.tmBundle
Created April 13, 2013 23:56
[dokuwiki.tmBundle] Add support for smart headline scopes so that their appearance (esp. font size) can be better controlled by Themes. Sample screenshot: http://imgur.com/FQ7ms89
{ name = 'markup.heading.${1/(=)(=)?(=)?(=)?(=)?(=)?/${6:?1:${5:?2:${4:?3:${3:?4:${2:?5:6}}}}}/}.dokuwiki';
begin = '(?:^|\G)(={1,6})\s*(?=[\S[^=]])';
end = '\s*(\1)?$\n?';
captures = { 1 = { name = 'punctuation.definition.heading.dokuwiki'; }; };
contentName = 'entity.name.section.dokuwiki';
},
@peta
peta / ffox-alias.sh
Created April 7, 2013 21:31
Shell alias for starting a new independent instance of Firefox
alias ffox='(/Applications/Firefox.app/Contents/MacOS/firefox-bin -no-remote -ProfileManager 1>/dev/null 2>/dev/null)'
@peta
peta / rdf-mongo.rb
Created April 5, 2013 00:49
Exemplary RDF.rb storage adapter
require 'rdf'
require 'enumerator'
require 'mongo'
module RDF
class Statement
##
# Creates a BSON representation of the statement.
# @return [Hash]
def to_mongo
@peta
peta / textmate_dialog_issue12_api.md
Last active December 15, 2015 06:29
More concrete suggestions for TextMate Dialog2's popup component; for more details and a mockup graphic see issue #12 (https://github.com/textmate/dialog/issues/12)

More concrete suggestions for TextMate Dialog2's popup component; for more details and a mockup graphic see issue #12.

API

Dummy table used as illustrative example throughout the following document:

===================================  
| IMG | NAME | INFOTEXT           |  
===================================  

| ICO | A | Something about A |

@peta
peta / demo-grammar.tmProperties
Last active March 21, 2020 04:58
Regex design pattern for Textmate language grammars. An absolutely cool feature of PCRE (even supported by Oniguruma) are named subexpression calls. Allowing for recursive matching while preserving (atomic) contexts at every recursion level in form of named match results. However, there is no light without shadow: When no multiline matches can b…
myPattern = {
name = 'meta.spec.triples';
begin = '(?x)
(?<subject> \g<iri> | \g<BlankNode> | \g<collection> ){0}
(?<iri> \g<IRIREF> | \g<PrefixedName> ){0}
(?<IRIREF> \< (?:[^\x00-\x20\<\>\\\"\{\}\|\^`] | (?:\\u[0-9A-Fa-f]{4}|\\U[0-9A-Fa-f]{8}))* \> ){0}
(?<PrefixedName> \g<PNAME_LN> | \g<PNAME_NS> ){0}
(?<PNAME_LN> (\g<PNAME_NS>) ( (?: [\p{L}\p{M}_] | [:0-9] | %[0-9A-Fa-f]{2} | [\\_~.\-!$&''\(\)*+,;=/?#@%] ) (?:(?:[\p{L}\p{M}_\-0-9\u00B7\u0300-\u036F\u203F-\u2040] | [:.] | %[0-9A-Fa-f]{2} | [\\_~.\-!$&''\(\)*+,;=/?#@%])* (?:[\p{L}\p{M}_\-0-9\u00B7\u0300-\u036F\u203F-\u2040] | : | %[0-9A-Fa-f]{2} | [\\_~.\-!$&''\(\)*+,;=/?#@%])) )? ){0}
(?<PNAME_NS> (?: [\p{L}\p{M}] (?:(?:[\p{L}\p{M}_.\-0-9\u00B7\u0300-\u036F\u203F-\u2040])* [\p{L}\p{M}_\-0-9\u00B7\u0300-\u036F\u203F-\u2040] )? )? \: ){0}
(?<BlankNode> \g<BLANK_NODE_LABEL> | \g<ANON> ){0}