Skip to content

Instantly share code, notes, and snippets.

View kjnilsson's full-sized avatar

Karl Nilsson kjnilsson

View GitHub Profile
@kjnilsson
kjnilsson / gist:52e2c862077dd77a8e86
Created September 3, 2014 08:38
fsautocomplete fsharp-vim log
> parse "/Users/karlnilsson/code/fs/test.fs" full
> module Test =
>
> let tryX () =
> Map.
> <<EOF>>
< INFO: Background parsing started
complete: base =
> completion "/Users/karlnilsson/code/fs/test.fs" 4 12
< DATA: errors
@kjnilsson
kjnilsson / gist:93cf2e695fd198e8692c
Created September 19, 2014 10:54
riemann-dash error when saving
[2014-09-19 03:44:25] INFO WEBrick 1.3.1
[2014-09-19 03:44:25] INFO ruby 1.9.3 (2011-10-30) [x86_64-linux]
== Sinatra/1.4.5 has taken the stage on 8080 for development with backup from WEBrick
[2014-09-19 03:44:25] INFO WEBrick::HTTPServer#start: pid=8251 port=8080
NoMethodError - undefined method `[]' for nil:NilClass:
/var/lib/gems/1.9.1/gems/riemann-dash-0.2.9/lib/riemann/dash/browser_config.rb:62:in `merge_configs'
/var/lib/gems/1.9.1/gems/riemann-dash-0.2.9/lib/riemann/dash/browser_config/file.rb:26:in `update'
/var/lib/gems/1.9.1/gems/riemann-dash-0.2.9/lib/riemann/dash/browser_config.rb:70:in `update'
/var/lib/gems/1.9.1/gems/riemann-dash-0.2.9/lib/riemann/dash/controller/index.rb:14:in `block in <class:App>'
/var/lib/gems/1.9.1/gems/sinatra-1.4.5/lib/sinatra/base.rb:1603:in `call'
@kjnilsson
kjnilsson / asynchow
Last active August 29, 2015 14:08
How do I make this properly async?
type ContentLengthHandler() =
inherit DelegatingHandler ()
override __.SendAsync (request, token) =
let resp = base.SendAsync(request, token).Result //GAH
match resp.Content with
| :? ObjectContent as oc ->
let s = oc.ReadAsStreamAsync().Result //GAH
resp.Content <- new StreamContent(s)
resp.Content.Headers.ContentLength <- Nullable (int64 s.Length)
Task.FromResult resp
@kjnilsson
kjnilsson / gist:8c8e4c86fc5ea316c3e0
Last active August 29, 2015 14:09
FsCheck problem/query
#r "./bin/Debug/FsCheck.dll"
open System
open FsCheck
//ensure fscheck is fully initialised.
Runner.init.Force()
let whiteList =
let x = ['a' .. 'z'] @ ['A' .. 'Z']
Gen.choose (0, x.Length - 1)
|> Gen.map (fun i -> x.[i])
@kjnilsson
kjnilsson / gist:d9c8fc813e047936c8ab
Created December 18, 2014 13:21
influxdb error log when writing to docker mounted directory
[2014/12/18 13:03:09 UTC] [INFO] (github.com/influxdb/influxdb/cluster.(*ClusterConfiguration).GetShardToWriteToBySeriesAndTime:834) No matching shards for write at time 1418907789187110u, creating...
[2014/12/18 13:03:09 UTC] [INFO] (github.com/influxdb/influxdb/cluster.(*ClusterConfiguration).createShards:865) createShards for space default: start: Thu Dec 18 00:00:00 +0000 UTC 2014. end: Thu Dec 25 00:00:00 +0000 UTC 2014
[2014/12/18 13:03:09 UTC] [INFO] (github.com/influxdb/influxdb/datastore.(*ShardDatastore).GetOrCreateShard:158) DATASTORE: opening or creating shard /mnt/data/db/shard_db_v2/00005
[2014/12/18 13:03:09 UTC] [EROR] (github.com/influxdb/influxdb/cluster.(*ClusterConfiguration).AddShards:1075) AddShards: error setting local store: %!(EXTRA rocksdb.DatabaseError=IO error: directory: Invalid argument)
[2014/12/18 13:03:09 UTC] [EROR] (github.com/influxdb/influxdb/coordinator.(*RaftServer).doOrProxyCommandOnce:168) Cannot run command &coordinator.CreateShardsCommand{Shards:[]*cluster.NewShardDa
@kjnilsson
kjnilsson / gist:c330928d1eab9138e489
Created December 19, 2014 11:48
mono segfault backtrace
(gdb) run FifteenBelow.VersionedStorage.Service.exe
Starting program: /usr/bin/mono FifteenBelow.VersionedStorage.Service.exe
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff4d1c700 (LWP 24667)]
[New Thread 0x7ffff45ff700 (LWP 24668)]
[New Thread 0x7ffff45be700 (LWP 24669)]
Configuration Result:
[Success] Name FifteenBelow.VersionedStorage.Service
[Success] DisplayName FifteenBelow Versioned Storage Service
@kjnilsson
kjnilsson / gist:e40f1d9fc8fb89829ac3
Created December 19, 2014 12:07
mono SIGSEGV gdp outpout
dev@ubuntu:~/vs$ sudo ./run.sh
Configuration Result:
[Success] Name FifteenBelow.VersionedStorage.Service
[Success] DisplayName FifteenBelow Versioned Storage Service
[Success] Description Provides a versioned store
[Success] ServiceName FifteenBelow.VersionedStorage.Service
Topshelf v3.1.122.0, .NET Framework v4.0.30319.17020
The FifteenBelow.VersionedStorage.Service service is now running, press Control+C to exit.
System.UInt16[] doesn't implement interface System.IDisposable
@kjnilsson
kjnilsson / gist:0e9a8c00c8ded89f538e
Created January 20, 2015 20:00
idris failed install
Failed to install trifecta-1.5
Build log ( /Users/karlnilsson/.cabal/logs/trifecta-1.5.log ):
[1 of 1] Compiling Main ( /var/folders/0_/18mv6y610d39ql2lyl5gtr_80000gn/T/trifecta-1.5-12709/trifecta-1.5/dist/setup/setup.hs, /var/folders/0_/18mv6y610d39ql2lyl5gtr_80000gn/T/trifecta-1.5-12709/trifecta-1.5/dist/setup/Main.o )
Linking /var/folders/0_/18mv6y610d39ql2lyl5gtr_80000gn/T/trifecta-1.5-12709/trifecta-1.5/dist/setup/setup ...
Configuring trifecta-1.5...
Building trifecta-1.5...
Preprocessing library trifecta-1.5...
[ 1 of 13] Compiling Text.Trifecta.Util.Array ( src/Text/Trifecta/Util/Array.hs, dist/build/Text/Trifecta/Util/Array.o )
[ 2 of 13] Compiling Text.Trifecta.Util.Combinators ( src/Text/Trifecta/Util/Combinators.hs, dist/build/Text/Trifecta/Util/Combinators.o )
[ 3 of 13] Compiling Text.Trifecta.Util.IntervalMap ( src/Text/Trifecta/Util/IntervalMap.hs, dist/build/Text/Trifecta/Util/IntervalMap.o )
ryx:~ karlnilsson$ cabal install trifecta
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: trifecta-1.5.1 (user goal)
trying: semigroups-0.16.0.1/installed-742... (dependency of trifecta-1.5.1)
next goal: parsers (dependency of trifecta-1.5.1)
rejecting: parsers-0.11.0.2/installed-82a... (conflict: trifecta =>
parsers>=0.12.1 && <1)
trying: parsers-0.12.1.1
next goal: attoparsec (dependency of parsers-0.12.1.1)
@kjnilsson
kjnilsson / gist:be28e7d43e9b963c4455
Created January 29, 2015 12:34
sharp and equality
public class CodeListElement
{
private readonly int codeContext;
private readonly string value;
public CodeListElement(int codeContext, string value)
{
this.codeContext = codeContext;
this.value = value;
}