Skip to content

Instantly share code, notes, and snippets.

View MatrixManAtYrService's full-sized avatar

Matt Rixman MatrixManAtYrService

View GitHub Profile
@MatrixManAtYrService
MatrixManAtYrService / layout.kbd.json
Last active March 31, 2016 03:40
Untitled Keyboard Layout
[
[
{
"x": 3.5,
"a": 7
},
"F3",
{
"x": 10.5
},
@MatrixManAtYrService
MatrixManAtYrService / README.md
Last active September 9, 2016 15:48
Simple-WebSocket-Server wrapper programs

I have been using these programs to work with parts of the Simple-WebSocket-Server library in Visual Studio 2015. Notice that SampleServer.cpp reads in a file called payload.txt, and then sends that payload when you send the 'm' command from the server, so you'll want to have a payload.txt in your working directory when you run it.

To connect:

  • Run both the client and the server.
  • [server] Press s<enter> to start the server
  • [client] Press s<enter> to connect the client

To send messages

  • Be connected
  • [server] Press m to send a message to all connected clients
@MatrixManAtYrService
MatrixManAtYrService / token_primer_test.py
Last active June 26, 2017 04:13
Loosely coupling a semantic brushstroke to a sentence
import unittest
from token_primer import Tokens
import re
class TokenRef(unittest.TestCase):
def test_search_generators(self):
# two canvasses, both pointing to a name with a colon
canvas_A = "His hobby is: spinning gold. His name is: Rumplestiltskin"
@MatrixManAtYrService
MatrixManAtYrService / test_ipfs.py
Created August 3, 2017 03:13
a hash curiosity
from hashlib import sha256
import multihash
from multihash import SHA2_256
from base58 import b58encode
import subprocess
class IPFS_interface(unittest.TestCase):
def test_hash_expectations(self):
    int foo[] = {1,2};   // an array of int
    char bar[] = "ab";   // an array of char
    void* baz = foo;   // a pointer to the first element of foo
    cout << *(baz++);    // you might think that this would print the second element of foo
    void* qux = bar; // a pointer to the first element of bar
    cout << *(qux++);    // you might think that this would print the second element of bar
double x = 5.001;
int n = (int)x;
cout << n; // output: 5
@MatrixManAtYrService
MatrixManAtYrService / decodeSpat.h
Last active September 7, 2017 14:08
Decoding an old (2014?) SPaT
#include <exception>
#include <array>
#include <stdint.h>
#define BUFFER_SIZE 10240
struct ControllerState
{
uint16_t PedCallActive = 0;
@MatrixManAtYrService
MatrixManAtYrService / itinerary.txt
Last active September 9, 2017 22:15
Candyland Road Trip
Pick up Drew's Gear
Drive 5.0 hours
Hotel in Grand Junction, Friday night
Sleep 8 hours
Pick up Drew @ GJT, 10:00 AM
- https://goo.gl/maps/ojm7HfQ9ivM2
Drive 1.75 hours
Moab Brewery (lunch?)
- https://goo.gl/maps/G3qvXJq8wMw

The Problem

When the SWSS (Simple-WebSocket-Server) client connects to a server running libwebsockets:

  • The connection gets set up, and data moves through
  • The server fails to to call the appropriate callback for the specified protocol (/sky/api/v0/controller-sky in the example shown here)

This libwebsockets implementation is working, which I know because:

  • The connection gets up, and data moves through
  • The server calls the correct callback for the specified protocol (front-panel-protocol)
@MatrixManAtYrService
MatrixManAtYrService / Makefile
Created September 26, 2017 22:25
qmk_firmware/keyboards/planck/keymaps/matrixman
MOUSEKEY_ENABLE = yes
BACKLIGHT_ENABLE = yes
ifndef QUANTUM_DIR
include ../../../../Makefile
endif