Skip to content

Instantly share code, notes, and snippets.

View niclashoyer's full-sized avatar

Niclas Hoyer niclashoyer

View GitHub Profile
@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) {

Dependencies

sudo dnf install git qt5-qtbase-devel qt5-qtsvg-devel qt5-qtserialport-devel

Building

@niclashoyer
niclashoyer / ioreg-svd.py
Last active August 29, 2015 14:24
Generating ioregs! macros from SVD files
from cmsis_svd.parser import SVDParser
def getaccess(field):
if field.access == 'read-only':
return ': ro'
if field.access == 'write-only':
return ': wo'
return ''
def getoffset(field):
@niclashoyer
niclashoyer / keybase.md
Created September 22, 2014 16:52
keybase.io GitHub verification

Keybase proof

I hereby claim:

  • I am niclashoyer on github.
  • I am niclashoyer (https://keybase.io/niclashoyer) on keybase.
  • I have a public key whose fingerprint is 7693 6404 9CAC 6CED BC02 C3E4 EDCE 346C 637C 3F49

To claim this, I am signing this object:

#!/bin/bash
curl -s http://www.ndr.de/sport/live/index.html | sed -n -e 's/.*\(http:\/\/.*akamaihd.*\.m3u8\).*/\1/p'
@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 / 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 / backup.sh
Last active August 29, 2015 13:57
Simple docker backup
#!/bin/bash
set -e
set -u
CONTAINER=$(docker ps -a --no-trunc | awk 'NR>1' | awk 'BEGIN {FS=" +"}; $5 ~ "^Up" {print $1}')
for C in $CONTAINER; do
echo "Backup for $C"
DATA=$(docker inspect $C)
@niclashoyer
niclashoyer / docker-snippets.sh
Created March 27, 2014 18:52
docker snippets
# get volumes for a container
docker inspect $container | jq '.[].Volumes|to_entries[].key'