Skip to content

Instantly share code, notes, and snippets.

View niclashoyer's full-sized avatar

Niclas Hoyer niclashoyer

View GitHub Profile
@niclashoyer
niclashoyer / gen-webid-cert.sh
Created April 26, 2012 10:14 — forked from njh/_README.md
Shell script to create a WebID certificate using OpenSSL
#!/bin/sh
#
# gen-webid-cert.sh: WebID Self-signed Certificate Generator
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
@niclashoyer
niclashoyer / convert.py
Created October 19, 2022 22:06
Simple script to convert arduino music to music for the "sensor watch". Run this in apps/buzzer-test/!
#!/bin/env python3
# simple script to convert notes from https://github.com/robsoncouto/arduino-songs
# to note/durations for use in apps/buzzer-test/
# from https://github.com/joeycastillo/Sensor-Watch
tempo = int(input("tempo in bpm (e.g. 120): "))
print("melody string (e.g. \"NOTE_B4,2,NOTE_E5,2\")")
print("Ctrl-D or Ctrl-Z ( windows ) to continue")
melody_str = ""
@niclashoyer
niclashoyer / bolt.patch
Last active April 2, 2021 15:32
Patch for bolt cms 3.7 for PHP 7.4 compatibility
Patch for 7.4 compatibility
@package bolt/bolt
@level 1
diff -uNBr bolt-orig/src/Controller/Frontend.php bolt/src/Controller/Frontend.php
--- bolt-orig/src/Controller/Frontend.php 2020-11-29 20:23:33.138756011 +0100
+++ bolt/src/Controller/Frontend.php 2021-04-02 17:32:03.669398282 +0200
@@ -541,18 +541,27 @@
if ($isLegacy) {
@niclashoyer
niclashoyer / flacmendo.sh
Last active May 2, 2020 08:34
Download a jamendo album as flac using the new v3.0 API (remember to insert your own application client id)
#!/bin/bash
# deps: bash, curl, sed, metaflac, jq
# remember to insert your own application client id (see CLIENTID below)
# to get an application client id register at http://developer.jamendo.com
set -e
set -u
function filtername() {
tr -cs "[:alnum:] \-&\(\)\?!" _
@niclashoyer
niclashoyer / sample gitignore for netbeans projects
Created April 12, 2011 19:18
gitignore for netbeans project that ignores generic configuration files that are generated by netbeans
#ant specific
dist/
build/
#netbeans specific
core
nbproject/*
!nbproject/project.properties
!nbproject/project.xml
@niclashoyer
niclashoyer / cpconfig.sh
Last active January 19, 2018 00:06
Replace environment variables in configuration files with optional default using perl regular expressions.
#!/bin/bash
#
# Replaces ${var:def} expressions in text files with environment variables with
# an optional default.
#
# Assuming VAR1 contains the value "foo" nad VAR2 is undefined, the following
# expressions will evaluate as given on the right side:
#
# ${VAR1} ~> foo
# ${VAR2:bar} ~> bar
@niclashoyer
niclashoyer / dexdis.coffee
Last active January 17, 2018 20:13
Quick hack for a redis like interface for IndexedDB
errs =
transaction: 'Operation not allowed during transaction'
wrongtype: 'Operation against a key holding the wrong kind of value'
notransaction: 'Operation not allowed without transaction'
notsupported: 'Operation not supported'
toomuchop: 'Operation with too much operands'
# calculate hamming weight (for BITCOUNT command)
# see http://jsperf.com/hamming-weight/4
hamming = (x) ->
@niclashoyer
niclashoyer / L20n-mixin.coffee
Last active September 15, 2016 09:05
L20n mixin for react.js (UNTESTED!)
###*
@jsx React.DOM
###
L20nMixin =
propTypes:
context: React.PropTypes.any.isRequired
getInitialState: ->
if @props.getLocalizedEntities?
ids = @props.getLocalizedEntities()
@niclashoyer
niclashoyer / 00-fedora-studio.md
Last active August 8, 2016 08:01
Fedora 19 Studio Setup

Fedora Studio Setup

@niclashoyer
niclashoyer / createevent.sparql
Created June 28, 2012 11:54
Example SPARQL Queries for Events
PREFIX time:<http://www.w3.org/2006/time#>
PREFIX geo:<http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX foaf:<http://xmlns.com/foaf/0.1/>
PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>
PREFIX event:<http://purl.org/NET/c4dm/event.owl#>
INSERT DATA {
_:ev a event:Event ;
event:time _:time .
_:time a time:Interval ;