Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block gubser

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
gubser /
Last active Jun 22, 2019
Walk the abstract syntax tree to find the data dependencies of a python script
Given the python code:
out.p = inp.x + inp.y
out.q = inp.y + 1
It finds these dependencies:
inputs are x, y
outputs are p, q
gubser / AsyncBoundedCacheTests.fs
Created Jan 30, 2019
Unit tests for bounded caching. Needs more.
View AsyncBoundedCacheTests.fs
module AsyncBoundedCacheTests
open System
open Xunit
let ``insert items`` () = async {
let f = fun x -> async {
do! Async.Sleep(1)
return x
gubser /
Created Jan 30, 2019
This python snippet parses the `vector` column as a list of integers delimited by space and adds it as a new column
| frame | which | center-x | center-y | vector | vector_array |
| 44 | 0 | 55.5 | 29.3 | "49 44 31 22 26 22 44 ..." | [49, 44, 31, 22, 26, 22, 44, ...] |
import pandas as pd
df = pd.read_csv(r"C:\Users\egubser\Downloads\blobs.csv", sep=';')
df['vector_array'] = df.vector.apply(lambda v: [int(k) for k in v.split(' ')])
gubser / AsyncBoundedCache.fs
Last active Jan 31, 2019
A bounded cache for async operations in F#
View AsyncBoundedCache.fs
module AsyncBoundedCache
open System
open System.Collections.Concurrent
open System.Threading
open System.Threading.Tasks
let startTime = DateTime.UtcNow.Ticks / 10000000L
let now () = int ((DateTime.UtcNow.Ticks / 10000000L) - startTime)
View text-symbol-halo.html
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>TextSymbol with Halo - 4.9</title>
#viewDiv {
gubser / TaskResultBind.fs
Last active Nov 6, 2018
Helper function to chain TaskResult producing functions
View TaskResultBind.fs
type TaskResult<'a,'b> = Task<Result<'a,'b>>
module TaskResult =
let bind (f: 'a -> TaskResult<'b,'e>) (x: TaskResult<'a,'e>): TaskResult<'b,'e> = task {
match! x with
| Ok success -> return! f success
| Error failure -> return Error failure
// should it be called bindResult or bindTask?
gubser / pathScanContext.fsx
Created Oct 11, 2018
A variant of pathScan that also passes HttpContext to the handler
View pathScanContext.fsx
#r "<path/to/Suave.dll>"
open Suave
open Suave.Successful
open Suave.RequestErrors
/// <summary>
/// Same as pathScan but also passes the HttpContext to the handler h.
/// See pathScan:
/// </summary>
let pathScanContext (pf : PrintfFormat<_,_,_,_,'t>) (h : HttpContext -> 't -> WebPart) : WebPart =
import json
import time
import logging
from collections import UserDict
class AutoReloadConfig(UserDict):
A dictionary that automatically reloads itself from a file.
On each call to __getitem__(), check if config is older than reload_period and if yes then reload from file.
View preliminary pathspider analyisis.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View The following generators are available on this platform: Unix Makefiles = Generates standard UNIX makefiles. Ninja = Generates files (experimental). Watcom WMake = Generates Watcom W
The following generators are available on this platform:
Unix Makefiles = Generates standard UNIX makefiles.
Ninja = Generates files (experimental).
Watcom WMake = Generates Watcom WMake makefiles.
CodeBlocks - Ninja = Generates CodeBlocks project files.
CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
CodeLite - Ninja = Generates CodeLite project files.
CodeLite - Unix Makefiles = Generates CodeLite project files.
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Unix Makefiles
You can’t perform that action at this time.