Skip to content

Instantly share code, notes, and snippets.

function tableAsString(tbl)
toReturn = "{"
for ind, val in pairs(tbl) do
if type(val) == "table" then
toReturn = toReturn .. (type(ind) == "number" and "" or ind .. "=") .. tableAsString(val) .. ","
else
local newVal
if type(val) == "string" then
newVal = "\"" .. val .. "\""
else
@jthistle
jthistle / sndBenchmark.cpp
Created February 5, 2019 17:43
Benchmarks different methods for single note dynamics in MuseScore
#include <iostream>
#include <vector>
#include <functional>
#include <math.h>
#include <sys/time.h>
#include <ctime>
namespace Bm
{
<!-- old one -->
<FretDiagram>
<frets>4</frets>
<fretOffset>2</fretOffset>
<string no="0">
<marker>88</marker>
</string>
<string no="1">
<dot>1</dot>
Thread 1 "mscore" hit Breakpoint 4, Ms::Segment::remove (this=0x5555595a3040, el=0x7fff7012c8a0) at /usr/MuseScore/libmscore/segment.cpp:618
618 int track = el->track();
(gdb) backtrace
#0 0x000055555688326b in Ms::Segment::remove(Ms::Element*) (this=0x5555595a3040, el=0x7fff7012c8a0) at /usr/MuseScore/libmscore/segment.cpp:618
#1 0x000055555686703f in Ms::Score::removeElement(Ms::Element*) (this=0x555559a0ca90, element=0x7fff7012c8a0)
at /usr/MuseScore/libmscore/score.cpp:1551
#2 0x000055555695c249 in Ms::RemoveElement::redo(Ms::EditData*) (this=0x555559f03fd0) at /usr/MuseScore/libmscore/undo.cpp:759
#3 0x000055555695988a in Ms::UndoStack::push(Ms::UndoCommand*, Ms::EditData*) (this=0x555559a19370, cmd=0x555559f03fd0, ed=0x0)
at /usr/MuseScore/libmscore/undo.cpp:244
#4 0x0000555556870b17 in Ms::Score::undo(Ms::UndoCommand*, Ms::EditData*) const (this=0x555559a0ca90, cmd=0x555559f03fd0, ed=0x0)
(gdb) backtrace
#0 0x00005555567482cb in Ms::Score::undoAddElement(Ms::Element*) (this=0x55555998d390, element=0x55555a4e0620)
at /usr/MuseScore/libmscore/edit.cpp:4567
#1 0x00005555567175d6 in Ms::ChordRest::drop(Ms::EditData&) (this=0x555558426e50, data=...) at /usr/MuseScore/libmscore/chordrest.cpp:556
#2 0x000055555685bfd6 in Ms::Rest::drop(Ms::EditData&) (this=0x555558426e50, data=...) at /usr/MuseScore/libmscore/rest.cpp:263
#3 0x000055555609dcc8 in Ms::applyDrop(Ms::Score*, Ms::ScoreView*, Ms::Element*, Ms::Element*, Qt::KeyboardModifiers, QPointF) (score=0x55555998d390, viewer=0x555559747d20, target=0x555558426e50, e=0x5555596040f0, modifiers=..., pt=...) at /usr/MuseScore/mscore/palette.cpp:447
#4 0x000055555609f9d2 in Ms::Palette::applyPaletteElement(Ms::PaletteCell*, QFlags<Qt::KeyboardModifier>) (this=0x555559784550, cell=0x5555597856e0, modifiers=...) at /usr/MuseScore/mscore/palette.cpp:709
#5 0x000055555609ff21 in Ms::Palette::mouseDoubleClickEvent(QMouseEvent*) (this=0x555559784550,
@jthistle
jthistle / replacer.py
Last active June 6, 2019 16:26
Adds a new field to every struct creation declaration
#!/usr/bin/env python3
import re, os
cwd = os.getcwd()
files = [x for x in os.listdir(cwd) if x[-4:] == ".cpp"]
for fname in files:
if fname[-len("inspectorMeasure.cpp"):] == "inspectorMeasure.cpp":
[{"type":"ROUND_START","time":1586274825186},{"type":"PICKUP_WALL","time":1586274825186,"player":0,"tile":{"suit":"CIRCLES","value":2}},{"type":"PICKUP_WALL","time":1586274825186,"player":0,"tile":{"suit":"DRAGONS","value":1}},{"type":"PICKUP_WALL","time":1586274825186,"player":0,"tile":{"suit":"CIRCLES","value":8}},{"type":"PICKUP_WALL","time":1586274825186,"player":0,"tile":{"suit":"CIRCLES","value":9}},{"type":"PICKUP_WALL","time":1586274825186,"player":0,"tile":{"suit":"WINDS","value":4}},{"type":"PICKUP_WALL","time":1586274825186,"player":0,"tile":{"suit":"CIRCLES","value":6}},{"type":"PICKUP_WALL","time":1586274825186,"player":0,"tile":{"suit":"BAMBOO","value":4}},{"type":"PICKUP_WALL","time":1586274825186,"player":0,"tile":{"suit":"CIRCLES","value":1}},{"type":"PICKUP_WALL","time":1586274825186,"player":0,"tile":{"suit":"WINDS","value":3}},{"type":"PICKUP_WALL","time":1586274825186,"player":0,"tile":{"suit":"CHARACTERS","value":3}},{"type":"PICKUP_WALL","time":1586274825186,"player":0,"tile":{"suit":"C
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
[
{
"type": "MultiPolygon",
"coordinates": [
[
[
[
-1.2764173415138111,
54.72468918724158
],
@jthistle
jthistle / configure-osu-tablet.py
Last active July 10, 2021 10:27
osu! tablet configuration script
#!/usr/bin/env python3
import sys
import subprocess
import argparse
import re
Y_OFFSET = 0
X_OFFSET = 0