Skip to content

Instantly share code, notes, and snippets.

View RadicalTeapot's full-sized avatar

Mathias Capdet RadicalTeapot

View GitHub Profile
@RadicalTeapot
RadicalTeapot / kivy_factory_and_builder.py
Created May 28, 2018 13:37
Kivy Factory and Builder usage
# -*- coding: utf-8 -*-
"""DOCSTRING."""
from kivy.app import App
from kivy.lang.builder import Builder
from kivy.factory import Factory
class MainApp(App):
def __init__(self, *args, **kwargs):
@RadicalTeapot
RadicalTeapot / kivy_modal_dialog.py
Created May 28, 2018 13:42
Kivy ModalView simple usage.
# -*- coding: utf-8 -*-
"""DOCSTRING."""
from kivy.app import App
from kivy.lang.builder import Builder
from kivy.factory import Factory
ui = """
Widget:
@RadicalTeapot
RadicalTeapot / kivy_events_property_callback.py
Created June 4, 2018 15:30
Kivy custom events and property callbacks
# -*- coding: utf-8 -*-
"""DOCSTRING."""
from kivy.app import App
from kivy.lang.builder import Builder
from kivy.properties import BooleanProperty
from kivy.uix.widget import Widget
ui = '''
@RadicalTeapot
RadicalTeapot / Vargrantfile
Created July 8, 2020 13:08
Vagrant setup for Apache Cordova to build android app in Ubuntu 18.04 LTS
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@RadicalTeapot
RadicalTeapot / CompressionTest.cs
Last active November 16, 2020 13:09
Test various data type arrays conversion to base64 encoded string and their resulting size
using System;
using System.Text;
namespace Test
{
class Program
{
public static readonly Random Rand = new Random();
public static readonly UTF8Encoding Encoding = new UTF8Encoding();
public static readonly int DataLength = ushort.MaxValue;
@RadicalTeapot
RadicalTeapot / testAllocation.html
Created November 18, 2020 10:52
Test javascript allocation speed
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test allocation</title>
</head>
<body>
@RadicalTeapot
RadicalTeapot / vcv bounds.lua
Created October 12, 2021 04:43
Lua file to load in Wrong People LUA module, inspired by JustMat's Bounds script for Monome Norns
-- Channels
INPUT_CHANNELS = {0, 1} -- Left and right audio input
SPEED_CHANNELS = {2, 3} -- Left and right speed change triggers
FLIP_CHANNELS = {4, 5} -- Left and right direction flip triggers
SKIP_CHANNELS = {6, 7} -- Left and right position skip triggers
OUTPUT_CHANNELS = {0, 1} -- Left and right audio outputs
-- Constants
DURATION = 8 -- Audio buffer duration in seconds
SPEEDS = {0.5, 0.6703, 1, 1.49831} -- Possible play head speed
@RadicalTeapot
RadicalTeapot / main.cpp
Created March 26, 2023 20:35
Read values from analog in and send them out to touchdesigner using serial communication
const size_t count = 6;
const uint8_t pins[count] = {A0, A1, A2, A3, A4, A5};
size_t i;
void setup() {
Serial.begin(9600);
}
void loop() {
for (i = 0; i < count; i++)
@RadicalTeapot
RadicalTeapot / unit-test.lua
Created April 27, 2024 22:57
Quick and dirty Neovim unit-test runner
local M = {
buf_nr = nil,
suites = {},
window_title = "Results: ",
buffer_namespace = { name = "ResultWindowNS", id = nil },
}
M.clear_internal_buffer = function()
if M.buf_nr ~= nil and vim.fn.bufexists(M.buf_nr) then
vim.api.nvim_buf_delete(M.buf_nr, { force = true })
@RadicalTeapot
RadicalTeapot / window-dimmer.lua
Last active April 29, 2024 12:32
Simple window dimmer for Neovim
local M = {
ns = vim.api.nvim_create_namespace("WindowDimmer"),
augrp_name = "WindowDimmerAuGroup",
hl_group = "Twilight", -- NOTE This supposes the `Twilight" group exists!
enabled = false,
enabled_buf = nil,
}
M.enable = function()
if not M.enabled then