Skip to content

Instantly share code, notes, and snippets.

@mwiemarc
mwiemarc / ds-duino.ino
Created February 4, 2021 10:04 — forked from dougalcampbell/ds-duino.ino
Digispark and nodejs - talking to the Digispark Arduino-compatible microcontroller via USB with the node-hid library
/*
* Accept control commands via USB.
*
* Commands start with '!' and end with '.'
* Commands have three parts: action, pin, value: !AAPPVV.
*
* E.g. '!01p101.' is DigitalWrite, Pin1, value = 1
*
* Note: This is currently *very* crude. Much improvement could be made.
* I think the use of strncpy is eating a lot of memory. Refactor?
@mwiemarc
mwiemarc / ColorConsole.cs
Created January 21, 2021 09:31 — forked from RickStrahl/ColorConsole.cs
Color Console - a simple class to add color to .NET Console commands more easily.
using System;
using System.Text;
using System.Text.RegularExpressions;
namespace MainColorConsole
{
class Program
{
static void Main(string[] args)
{
@mwiemarc
mwiemarc / flappy.html
Created November 30, 2020 09:20 — forked from gullyn/flappy.html
Flappy bird in 228 bytes (improved!)
<body onload="z=c.getContext`2d`,p=Y=Q=',9|z.fillRect(',setInterval(`c.height=W=300,p?Y<W&&Y>P&Y<P+E|p>9?z.fillText(S++,0${Q}0,Y-=M-=.5,9${Q}p-=8,0${Q}p,P+E,9,W),P))):(p=M=S=0,Y=E=99):(p=W+4,P=S%E)`,24)"onclick=M=9><canvas id=c>
@mwiemarc
mwiemarc / background.js
Created October 3, 2020 22:41 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@mwiemarc
mwiemarc / custom_game_engines_small_study.md
Created June 30, 2020 12:42 — forked from raysan5/custom_game_engines_small_study.md
A small state-of-the-art study on custom engines

CUSTOM GAME ENGINES: A Small Study

a_plague_tale

A couple of weeks ago I played (and finished) A Plague Tale, a game by Asobo Studio. I was really captivated by the game, not only by the beautiful graphics but also by the story and the locations in the game. I decided to investigate a bit about the game tech and I was surprised to see it was developed with a custom engine by a relatively small studio. I know there are some companies using custom engines but it's very difficult to find a detailed market study with that kind of information curated and updated. So this article.

Nowadays lots of companies choose engines like Unreal or Unity for their games (or that's what lot of people think) because d

@mwiemarc
mwiemarc / foo.sh
Last active February 28, 2020 15:28 — forked from drmalex07/README-create-debian-startup-script.md
An example of how to create a init.d script in Debian, using dependency booting. #debian #init.d #lsb-script #startup-script
#! /bin/bash
### BEGIN INIT INFO
# Provides: foo
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: foo service
# Description: Run Foo service
@mwiemarc
mwiemarc / add-wintts-voices.ps1
Created November 15, 2019 14:09
Enable installed text-to-speech voices in windows
$sourcePath = 'HKLM:\software\Microsoft\Speech_OneCore\Voices\Tokens' #Where the OneCore voices live
$destinationPath = 'HKLM:\SOFTWARE\Microsoft\Speech\Voices\Tokens' #For 64-bit apps
$destinationPath2 = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\SPEECH\Voices\Tokens' #For 32-bit apps
cd $destinationPath
$listVoices = Get-ChildItem $sourcePath
foreach($voice in $listVoices) {
$source = $voice.PSPath #Get the path of this voices key
copy -Path $source -Destination $destinationPath -Recurse
copy -Path $source -Destination $destinationPath2 -Recurse
}
private static byte[] StartSpeak(string word)
{
var ms = new MemoryStream();
using (System.Speech.Synthesis.SpeechSynthesizer synhesizer = new System.Speech.Synthesis.SpeechSynthesizer())
{
foreach (var voice in synhesizer.GetInstalledVoices())
{
Console.WriteLine("select(y/n): " + voice.VoiceInfo.Name);
var key = Console.ReadKey();
if (key.Key == ConsoleKey.Y)
@mwiemarc
mwiemarc / Base64.lua
Created November 6, 2019 01:06 — forked from bortels/Base64.lua
Base64 encode/decode for Codea (Lua)
-- Lua 5.1+ base64 v3.0 (c) 2009 by Alex Kloss <[email protected]>
-- licensed under the terms of the LGPL2
-- character table string
local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
-- encoding
function enc(data)
return ((data:gsub('.', function(x)
local r,b='',x:byte()
SAC = {}
SAC_AddonName = 'MyAddon'
local function ShowDialog()
local txt =
'Es ist kein Geheimnis, dass das Markenzeichen der Defiasbande ihre roten Kopftücher sind. Aber wir haben herausgefunden, dass das Material, aus dem diese Kopftücher gemacht sind, den Rang des Bandenmitglieds bezeichnet. Jetzt, wo wir das wissen, möchte ich, dass Ihr so viele hochrangige Mitglieder der Defias eliminiert, wie Ihr könnt. Die Bandenmitglieder mit der höchsten Position findet Ihr zweifellos in van Cleefs Geheimversteck. Wenn Ihr fertig seid, bringt mir 10 rote Seidenkopftücher zum Beweis, dass sie tot sind, dann werde ich Euch belohnen. Viel Glück, <Name>.'
local encoded = EncodeString(txt)
SAC.DialogFrame:Show()