This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import '[edu.emory.mathcs.jtransforms.fft DoubleFFT_1D]) | |
(defn fft [data] (let [a-data (into-array Double/TYPE data) | |
fftfun (DoubleFFT_1D. (count data)) | |
dummy (.realForward fftfun a-data)] a-data)) | |
;; Example: Constant signal | |
(fft (take 128 (repeat 1.0))) | |
;; [optional] view the result as vector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns myapp.actions | |
:require [myapp.core :refer app-state]) | |
(defn action1 [] | |
(swap! app-state inc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function anagram_score(str1, str2) | |
# score for a sequence: [1,2,3,4] => 1; [1,4,2,3] => 3 | |
score(sec) = count(i->i!=1,sec[2:end]-sec[1:end-1]) + 1 | |
function match_inner(str1,tokens,accu) | |
if str1 == "" | |
score(accu) | |
else | |
minimum(match_inner(str1[2:end],filter(t->t!=x,tokens),[accu;x[2]]) for x in filter(t -> (t[1] == str1[1]), tokens)) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug,Clone)] | |
struct Match { | |
c: u8, // character | |
pos: usize // position | |
} | |
fn score(matches: &[Match]) -> usize { | |
let l = matches.len(); | |
let mut s = 1; | |
if l < 2 { return s } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ Info: Recompiling stale cache file C:\Users\User\.julia\compiled\v0.7\IJulia\nfu7T.ji for IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a] | |
┌ Warning: __precompile__() is now the default | |
│ caller = top-level scope at none:0 | |
└ @ Core none:0 | |
┌ Warning: __precompile__() is now the default | |
│ caller = top-level scope at none:0 | |
└ @ Core none:0 | |
PROFILE = Dict{String,Any}("key"=>"cb9fd8c0-c339d5f3ef4a0e882c7380da","transport"=>"tcp","signature_scheme"=>"hmac-sha256","shell_port"=>59222,"hb_port"=>59226,"control_port"=>59225,"ip"=>"127.0.0.1","stdin_port"=>59224,"iopub_port"=>59223,"kernel_name"=>"julia-0.7") | |
20:21:26(): SENDING IPython Msg [ idents status ] { | |
parent_header = Dict("username"=>"jlkernel","session"=>"UUID(\"dd9690db-232f-454c-baf9-bfd29644aafd\")"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(base) C:\Users\User>jupyter notebook --debug | |
[D 21:42:25.972 NotebookApp] Searching ['C:\\Users\\User', 'C:\\Users\\User\\.jupyter', 'C:\\Users\\User\\Miniconda3\\etc\\jupyter', 'C:\\ProgramData\\jupyter'] for config files | |
[D 21:42:25.972 NotebookApp] Looking for jupyter_config in C:\ProgramData\jupyter | |
[D 21:42:25.973 NotebookApp] Looking for jupyter_config in C:\Users\User\Miniconda3\etc\jupyter | |
[D 21:42:25.973 NotebookApp] Looking for jupyter_config in C:\Users\User\.jupyter | |
[D 21:42:25.973 NotebookApp] Looking for jupyter_config in C:\Users\User | |
[D 21:42:25.974 NotebookApp] Looking for jupyter_notebook_config in C:\ProgramData\jupyter | |
[D 21:42:25.974 NotebookApp] Looking for jupyter_notebook_config in C:\Users\User\Miniconda3\etc\jupyter | |
[D 21:42:25.974 NotebookApp] Looking for jupyter_notebook_config in C:\Users\User\.jupyter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using RecipesBase | |
using StatPlots | |
@userplot MeanPlot | |
@userplot AutocorPlot | |
@userplot HistogramPlot | |
@userplot DensityPlot | |
@userplot MixedDensityPlot | |
@userplot TracePlot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Base.iterate(mf::MyFlatten{I,T}, state=nothing) where {I,T} | |
if state===nothing | |
val = iterate(mf.a) | |
val === nothing && return nothing | |
itr, s = val | |
res = iterate(itr) | |
else | |
itr, s, inner_s = state | |
res = iterate(itr, inner_s) | |
end |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import logging | |
import time | |
import picamera | |
from fractions import Fraction | |
EQUILIBRATION_SECONDS = 10 |
OlderNewer