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
#!/bin/bash | |
# | |
# Script that combines all run images into one | |
# html file for quality assurance. | |
# | |
# Assess plots for unusually bad motion or extreme | |
# amounts of censoring | |
# | |
# Examples of functions and redirecting output | |
# |
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
while run_trial is True: | |
imageStim.draw() | |
# Additional debug dumping crap | |
data=tracker.getLastSample() | |
if data: | |
gaze_dot_left.setPos([data[11],data[12]]) | |
gaze_dot_left.draw() | |
gaze_dot_right.setPos([data[30],data[31]]) | |
gaze_dot_right.draw() |
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
Public Overrides Sub RegisterArea(ByVal context As System.Web.Mvc.AreaRegistrationContext) | |
'' general api routes | |
context.MapRoute( | |
"api_default_sub_resource", | |
"api/v1/{controller}/{resource}/{subresource}/{action}.xml", | |
New With {.version = "1"} | |
) | |
context.MapRoute( |
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
open System | |
open System.IO | |
open System.Net | |
open System.Diagnostics | |
let track (url:string) (log:string) = | |
while true do | |
let stopwatch = new Stopwatch() | |
stopwatch.Start() |
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
(* insert `thing` into each possible place of a list *) | |
let rec inserts thing = function | |
| [] -> [ [thing] ] | |
| (head :: rest) as all -> | |
let normal = thing :: all | |
let inserted = List.map (fun n -> head::n) (inserts thing rest) | |
normal :: inserted | |
(* give all possible permutations of a list (does not care about uniqueness of elements) *) | |
let rec permutations = function |
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
let (|>) a b = | |
let result = a |> b | |
result (* breakpoint goes here *) |
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
let (|Matches|_|) pattern input = | |
let matches = Regex.Matches(input, pattern) | |
if matches.Count > 0 then Some [ for m in matches -> m ] else None | |
let (|MatchesR|_|) (regex:Regex) input = | |
let matches = regex.Matches input | |
if matches.Count > 0 then Some [ for m in matches -> m ] else None |
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
let book = Map [(1, ["daniel"; "martin"; "bella"]); (2, ["daniel"; "martin"]); (3, ["bella"])];; | |
let words = book |> Map.toList |> List.map snd |> List.concat |> Set.ofList | |
let inverseBook = | |
[ for word in words do | |
let pages = | |
book | |
|> Map.toList | |
|> List.choose (fun (page, pageWords) -> if List.exists ((=) word) pageWords then Some page else None) |
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
let parseFacets (input:Dictionary<string,obj>) = | |
let facets = new Dictionary<string,IDictionary<string,int>>() | |
let add k v = facets.Add(k, v) | |
let parse k = | |
input.[k] | |
:?> IEnumerable<KeyValuePair<string,obj>> | |
|> Seq.map (fun kvp -> kvp.Key, kvp.Value :?> int) | |
|> Map.ofSeq | |
:> IDictionary<string,int> | |
|> add k |
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
let rec union l1 l2 = | |
match l2 with | |
| [] -> l1 | |
| x :: xs -> | |
if memb x l1 then | |
union l1 xs | |
else | |
union (x::l1) xs |