Skip to content

Instantly share code, notes, and snippets.

@GreyCat
GreyCat / BenchmarkMidi.scala
Created October 26, 2016 08:29
Benchmark FastParse + MidiParse
import java.nio.file.{Files, Paths}
import fastparse.byte.Midi.MidiData.Controller
import fastparse.byte.Midi.MidiEvent
import fastparse.byte.MidiParse
import scodec.bits.ByteVector
import java.text.DecimalFormat
import java.text.DecimalFormatSymbols
import java.util.Locale
@GreyCat
GreyCat / c-struct-to-ksy.rb
Created March 25, 2017 10:53
Convert C struct into Kaitai Struct spec (.ksy)
#!/usr/bin/env ruby
require 'yaml'
TYPE_TO_KSY = {
'uint8_t' => 'u1',
'uint16_t' => 'u2',
'uint32_t' => 'u4',
'uint64_t' => 'u8',
{
"chunks": [
{
"body": {
"chunks": [
{
"body": {
"version": 700
},
"len": 2,
chunks:
- body:
chunks:
- body:
version: 700
len: 2
tag: tags_vrsn
- body:
foo1: 8
foo2: 40
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<chunks type="array">
<chunk>
<body>
<chunks type="array">
<chunk>
<body>
<version type="integer">700</version>
</body>
{
"blocks": [
{
"block_type": "block_type_extension",
"body": {
"body": {
"application_id": {
"bytes": "4E 45 54 53 43 41 50 45 32 2E 30",
"num_bytes": 11
},
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<blocks type="array">
<block>
<block-type>block_type_extension</block-type>
<body>
<body>
<application-id>
<bytes>4E 45 54 53 43 41 50 45 32 2E 30</bytes>
<num-bytes type="integer">11</num-bytes>
blocks:
- block_type: block_type_extension
body:
body:
application_id:
bytes: 4E 45 54 53 43 41 50 45 32 2E 30
num_bytes: 11
subblocks:
- bytes: 01 00 00
num_bytes: 3
@GreyCat
GreyCat / Dockerfile
Created April 20, 2019 01:25
Dockerfile for web IDE
# To build: `docker build --tag webide .`
# To run: `docker run --rm -p 4444:4444 webide:latest`
FROM node:lts-stretch
COPY . /webide
WORKDIR /webide
RUN apt-get update && apt-get install -y python-ruamel.yaml

Keybase proof

I hereby claim:

To claim this, I am signing this object: