Skip to content

Instantly share code, notes, and snippets.

View Warwolt's full-sized avatar

Rasmus Källqvist Warwolt

  • Mojang Studios
  • Stockholm
View GitHub Profile
import Control.Monad
import Control.Monad.Reader
-- FRP
type Time = Float
type Behavior a = (Time -> a)
type Event a = (Time, a)
inf :: Time
inf = 1/0
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/c/Users/v-raskal/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
def light_up_element(self, element_name, color):
"""
Send a midi message to light up an element.
element_name: the name of the element to light up
color: a string 'red', 'orange', or 'green'
"""
status = MIDI_NOTE_ON_STATUS + MIDI_CHANNEL_NUM
note = self._element_color_to_midi[element_name][color]
velocity = 127
@Warwolt
Warwolt / .py
Last active July 29, 2020 09:36
def create_note_to_midi_dict():
"""
Create a dict for the the midi implementation table in the Xone K2 manual,
used to make it easier to refer to the byte values of the midi notes.
The key value pairs are e.g. ('c#1', 25) or ('g4', 67).
"""
notes = ['c','c#','d','d#','e','f', 'f#', 'g','g#','a','a#','b']
octaves = [str(num) for num in range(-1, 10)]
octave_notes = [note + octave for octave in octaves for note in notes]
cmake_minimum_required(VERSION 3.16)
project(HelloStaticLib)
add_library(hellolib STATIC hello.cpp)
add_executable(hello main.cpp)
target_link_libraries(${CMAKE_SOURCE_DIR}/hellolib.a) # complains about hellolib.a not being built by us
@Warwolt
Warwolt / config
Created March 11, 2020 14:45
my terminator config
[global_config]
title_transmit_bg_color = "#3465a4"
[keybindings]
[layouts]
[[default]]
[[[child1]]]
parent = window0
type = Terminal
[[[window0]]]
parent = ""
#include <zmq.hpp>
#include <string>
#include <iostream>
int main()
{
std::cout << "client started" << std::endl;
/* Prepare our context and socket */
zmq::context_t context(1);
#include <zmq.hpp>
#include <string>
#include <iostream>
int main()
{
std::cout << "client started" << std::endl;
/* Prepare our context and socket */
zmq::context_t context(1);
#include <stdio.h>
#include <stdlib.h>
enum result_type {OK, ERROR};
#define _RESULT_TYPE_NAME(a, b) _ ## a ## _ ## b ## _result
#define RESULT_TYPE_NAME(a, b) _RESULT_TYPE_NAME(a, b)
#define RESULT_TYPE(ret_type, err_type) struct RESULT_TYPE_NAME(ret_type, err_type)
#define DEFINE_RESULT_TYPE(ret_type, err_type) \
RESULT_TYPE(ret_type, err_type) \