Skip to content

Instantly share code, notes, and snippets.

View ssfrr's full-sized avatar

Spencer Russell ssfrr

View GitHub Profile
@ssfrr
ssfrr / itertest.jl
Last active August 29, 2015 14:03
Testing iterating through objects at global scope
function for_in!(arr::Array{Float32})
l::Int = length(arr)
for i::Int in 1:l
arr[i] += 2pi
end
gc()
end
function while_loop!(arr::Array{Float32})
i::Int = 1
@ssfrr
ssfrr / buftest.jl
Last active August 29, 2015 14:03
Testing per-function-call allocation against re-using buffer in type
type BufContainer
inc_amt::Float32
buf::Array{Float32}
BufContainer(inc_amt) = new(inc_amt, Array(Float32, 1024))
end
function with_alloc(cont::BufContainer)
buf = Array(Float32, 1024)
for i in 1:length(buf)
{
"_links":{
"self":{
"href":"http://example.com/sensors/523"
},
"curies":[
{
"name":"rel",
"href":"http://docs.example.com/relations/{rel}",
"templated":true
@ssfrr
ssfrr / unwrap.jl
Created December 16, 2013 21:46
Julia implementation of a phase unwrap function
function unwrap(v, inplace=false)
# currently assuming an array
unwrapped = inplace ? v : copy(v)
for i in 2:length(v)
while unwrapped[i] - unwrapped[i-1] >= pi
unwrapped[i] -= 2pi
end
while unwrapped[i] - unwrapped[i-1] <= -pi
unwrapped[i] += 2pi
end
@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:
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:1695888
Created January 28, 2012 21:56
Gui freezes sporadically
Starting program: /Applications/Pd-extended.app/Contents/Resources/bin/pdextended manta-help.pd
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
StartNotification name = default
tk scaling is 0.999781005071
Pt_Start() called
Reading symbols for shared libraries ++ done
Reading symbols for shared libraries + done
Reading symbols for shared libraries + done