Skip to content

Instantly share code, notes, and snippets.

View Bunkerbewohner's full-sized avatar

Mathias Kahl Bunkerbewohner

View GitHub Profile
@Bunkerbewohner
Bunkerbewohner / unity-detect-wireless-buzzer.cs
Created May 3, 2021 09:28
Detecting wireless Buzz! buzzers with Unity engine
using System;
using System.Collections.Generic;
using HidSharp; // https://www.nuget.org/packages/HidSharp/
using UnityEngine;
namespace Goldsaucer.Askutron.HardwareInput
{
public class WirelessBuzzBuzzers : MonoBehaviour
{
class ConnectedReceiver
#include "QrCode.hpp" // from https://github.com/nayuki/QR-Code-generator
#include "ImageUtils.h" // from Unreal Engine (4.24)
/// <summary>Generates a QR code texture from a string.</summary>
/// <param name="parent">UE parent (required)</param>
/// <param name="string">String to encode</param>
UTexture2D* UWebBuzzers::GenerateQrCode(UObject* parent, FString string)
{
qrcodegen::QrCode qr = qrcodegen::QrCode::encodeText(TCHAR_TO_UTF8(*string), qrcodegen::QrCode::Ecc::LOW);
public IEnumerator SpeakUp()
{
var tts = new TextToSpeech("Hello World", "en");
yield return tts.Load();
yield return tts.Play();
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Goldsaucer.Askutron.TTS
{
public class TextToSpeech
{
private const string ServerUrl = "https://example.com";
{
"text": "Who is the most badass female character in the \"Harry Potter\" novels?",
"language": "en",
"mode": "opinion",
"audio": "/audios/79470/download",
"answers": [
{
"text": "Hermione Granger",
"correct": true,
"audio": "/audios/31/download"
<?php
/*
Plugin Name: List Posts with Custom Field
Plugin URI: http://www.christianschenk.org/projects/wordpress-list-posts-custom-field-plugin/
Description: Inserts a list of posts with a certain custom field.
Version: 1.9.4
Author: Christian Schenk
Author URI: http://www.christianschenk.org/
*/
package de.hermes.ccs.legacy.rest.patch;
import com.fasterxml.jackson.core.type.TypeReference;
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
import java.util.List;
public class ListPatch<T extends List<M>, M> extends Patch<T> {
public ListPatch(Class<M> modelClass) {
super((Class<T>)((ParameterizedTypeImpl)new TypeReference<List<M>>() {}.getType()).getRawType());

Keybase proof

I hereby claim:

  • I am bunkerbewohner on github.
  • I am mathias_kahl (https://keybase.io/mathias_kahl) on keybase.
  • I have a public key ASCd0pJoRb85L9b7eYDi7qj6R2iBcvKYy8qTeOOPUORQDgo

To claim this, I am signing this object:

@Bunkerbewohner
Bunkerbewohner / light
Created March 29, 2014 00:26
A simple Ruby shell script to control LIFX (http://lifx.co) light bulbs.
#!/usr/bin/env ruby
require 'lifx'
if ARGV.length > 0
# see if a specific lamp is addressed
label = /^on|off|0x[0-9a-f]{6}$/.match(ARGV[0]) ? nil : ARGV[0]
# discover lamps and wait for label data to be available
client = LIFX::Client.lan
@Bunkerbewohner
Bunkerbewohner / guid.js
Created June 27, 2013 12:19
Generating a GUID for javascript applications and storing it in HTML5 local strorage.
function generate_guid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}
function get_guid() {
if (window.localStorage.guid != null) {