Skip to content

Instantly share code, notes, and snippets.

View ssfrr's full-sized avatar

Spencer Russell ssfrr

View GitHub Profile
diff --git a/core/Manta.cpp b/core/Manta.cpp
index ebf4485..4e7f8a9 100644
--- a/core/Manta.cpp
+++ b/core/Manta.cpp
@@ -48,37 +48,56 @@ void Manta::FrameReceived(int8_t *frame)
/* input frames have one reportID byte at the beginning */
for(int i = 1; i < 53; ++i)
{
+ /*
+ * overall pad logic:
@ssfrr
ssfrr / gist:7076289
Last active December 26, 2015 02:09
serializer with custom collection
class Doppel2Serializer(serializers.HyperlinkedModelSerializer):
@property
def data(self):
'''If a collection was requested (self.many is True), then we want to
return the full collection resource, including its own URL. This is
mostly cribbed from the BaseSerializer definition'''
if self._data is None:
obj = self.object
if self.many:
@ssfrr
ssfrr / gist:f129b321317aa5a735b2
Created February 29, 2016 16:09
GLVisualize Error
1 : #version 330
2 :
3 : #extension GL_ARB_conservative_depth: enable
4 :
5 : #define CIRCLE 0
6 : #define RECTANGLE 1
7 : #define ROUNDED_RECTANGLE 2
8 : #define DISTANCEFIELD 3
9 :
10 : in vec4 f_color;
// Build with gcc --shared -o cbtest.so
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
typedef void *(*callback_t)(void *);
pthread_t thread;
callback_t cb = NULL;

Keybase proof

I hereby claim:

  • I am ssfrr on github.
  • I am ssfrr (https://keybase.io/ssfrr) on keybase.
  • I have a public key whose fingerprint is 4930 5D94 B9E9 0374 4A3A 0A43 3A19 7F2E 8259 4329

To claim this, I am signing this object:

julia> struct DupVector{T} <: AbstractVector{T}
A::Vector{T}
end
julia> Base.size(dv::DupVector) = size(dv.A) .* 2
julia> @inline function Base.getindex(dv::DupVector, idx)
@boundscheck checkbounds(dv, idx)
dv.A[div(idx+1, 2)]
end
@ssfrr
ssfrr / gist:92c9f725185b68db76d960a5110caaa6
Created September 21, 2017 03:23
supercolliderjs long output
{"Classes/NamedControl": {"string": "SCDocEntry(\"Classes/NamedControl\", \"NamedControl\", \"Named reference to a control\")","compileString": "SCDocEntry.new","class": "SCDocEntry"},"Classes/Pnaryop": {"string": "SCDocEntry(\"Classes/Pnaryop\", \"Pnaryop\", \"n-ary operator pattern\")","compileString": "SCDocEntry.new","class": "SCDocEntry"},"Classes/PanB2": {"string": "SCDocEntry(\"Classes/PanB2\", \"PanB2\", \"2D Ambisonic B-format panner.\")","compileString": "SCDocEntry.new","class": "SCDocEntry"},"Classes/DegreeToKey": {"string": "SCDocEntry(\"Classes/DegreeToKey\", \"DegreeToKey\", \"Convert signal to modal pitch.\")","compileString": "SCDocEntry.new","class": "SCDocEntry"},"Classes/FFTTrigger": {"string": "SCDocEntry(\"Classes/FFTTrigger\", \"FFTTrigger\", \"Outputs the necessary signal for FFT chains, without doing an FFT on a signal\")","compileString": "SCDocEntry.new","class": "SCDocEntry"},"Classes/Pfindur": {"string": "SCDocEntry(\"Classes/Pfindur\", \"Pfindur\", \"limit total duration of event
-----------STDOUT-----------
init_OSC
----------------------------
-----------STDOUT-----------
compiling class library...
----------------------------
-----------STDOUT-----------
initPassOne started
@ssfrr
ssfrr / gist:32e40d2e2bec11ecce7aba5fa2128773
Created October 16, 2017 00:13
"invalid age range update" error
Main> using SampledSignals, PortAudio, WAV
Main> f = open("/home/sfr/Dropbox/chris_mann.wav")
IOStream(<file /home/sfr/Dropbox/chris_mann.wav>)
Main> wav = WAVSource(f)
WAV.WAVSource{IOStream,FixedPointNumbers.Fixed{Int16,15}}(IOStream(<file /home/sfr/Dropbox/chris_mann.wav>), WAV.WAVFormat(0x0001, 0x0001, 0x0000ac44, 0x00015888, 0x0002, 0x0010, WAV.WAVFormatExtension(0x0000, 0x00000000, UInt8[])), Dict{Symbol,Array{UInt8,1}}(), 5876768, 5876768)
Main> buf = read(wav, 10s)
WARNING: An error occurred during inference. Type inference is now partially disabled.
using Makie, GeometryTypes, Colors
using Reactive
using Juno
using DSP
using LibSndFile, FileIO
using PortAudio, SampledSignals
using BenchmarkTools
N = 1024 # size of audio read
N2 = N÷2+1 # size of rfft output