Skip to content

Instantly share code, notes, and snippets.

@futurechimp
futurechimp / tracking.csv
Last active April 24, 2020 14:11
Hypothetical pseudocode data stored by a location surveillance app.
Timestamp location real name
2020-04-25-00:02:32:56 outside front of 46 Mildmay Road London N16 Bob
2020-04-25-00:02:32:56 inside 31 St. Asaph Road London SE4 Alice
2020-04-25-00:02:33:05 outside front of 42 Mildmay Road London N16 Bob
2020-04-25-00:02:33:05 inside 31 St. Asaph Road London SE4 Alice
@futurechimp
futurechimp / index.js
Last active April 23, 2020 10:32
Sphinx WebAssembly example
import * as wasm from "nym-sphinx-wasm";
async function main() {
var gatewayUrl = "wss://path.to.gateway:1793";
var directoryUrl = "https://directory.nymtech.net/api/presence/topology";
// Get the topology, then the mixnode and provider data
const topology = await getTopology(directoryUrl);
// Set up a websocket connection to the gateway node
@futurechimp
futurechimp / main.go
Last active April 1, 2019 12:34
Grab an account balance from the Ethereum blockchain
package main
import (
"context"
"fmt"
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
)
### Keybase proof
I hereby claim:
* I am futurechimp on github.
* I am futurechimp (https://keybase.io/futurechimp) on keybase.
* I have a public key ASB6XoVbAMqoQv2uriHA6PLCmI1G5lQm8hCbuo43IaCuhAo
To claim this, I am signing this object:
servlet_name [MyScalatraServlet]: Flowers
scala_version [2.9.2]:
version [0.1.0-SNAPSHOT]:
missing region "; do
case $@end$ tag
Can't parse chunk: (grep ^sbt.version project/build.properties)
versionString=${versionLine##sbt.version=}
echo "
line 1:7: unexpected char: '^'
at org.antlr.stringtemplate.language.ActionLexer.nextToken(ActionLexer.java:220)
@futurechimp
futurechimp / gist:3733579
Created September 16, 2012 18:14
@casualjim - Maybe some trouble with the whole LifeCycle / ScalatraBootstrap thing here?
> compile
[info] Compiling 6 Scala sources to /home/dave/workspace/manning-book/swagger-sample-app/target/scala-2.9.2/classes...
[error] /home/dave/workspace/manning-book/swagger-sample-app/src/main/scala/Bootstrap.scala:3: LifeCycle is not a member of org.scalatra
[error] import org.scalatra.LifeCycle
[error] ^
[error] /home/dave/workspace/manning-book/swagger-sample-app/src/main/scala/Bootstrap.scala:5: not found: type LifeCycle
[error] class ScalatraBootstrap extends LifeCycle {
[error] ^
[error] /home/dave/workspace/manning-book/swagger-sample-app/src/main/scala/Bootstrap.scala:10: value mount is not a member of javax.servlet.ServletContext
[error] context mount (new PetServlet, "/pet")
@futurechimp
futurechimp / gist:2250617
Created March 30, 2012 10:20
Padrino 0.10.6 problem on first request in JRuby
# Startup completes successfully. Hitting the first URL, the following error is thrown:
# java package `org.jruby.rack.name.name.name' does not have a method `split'
# this has also happened on javax.security.name.name.name
# Reading the stack trace, we can see that it's somehow related to
https://github.com/padrino/padrino-framework/blob/master/padrino-core/lib/padrino-core/reloader.rb#L106
# The code in question is the "split" method call on the first line of lock!:
// This action receives the file upload.
post("/upload") {
processFile(fileParams("somefile"))
}
// This method processes the uploaded file in some way.
private def processFile(upload:FileItem) = {
val filePath:String = "/some/place/to/store/the/file"
val file:File = new File(filePath + upload.getName)
upload.write(file);
@futurechimp
futurechimp / gist:1966777
Created March 3, 2012 15:48
let's mess with the scalatra docs
The current Scalatra book structure is as follows. Personally I find it confusing that some information can be found in more than one part of the book.
Table of Contents
Introduction
What is Scalatra?
Introduction
Git clone alternative
Dependencies
Building
Hello World Application
@futurechimp
futurechimp / gist:1927503
Created February 27, 2012 22:17
The Conundrum
/* Here's the first way, the "view" version: When your code calls request.pathInfo, the compiler says,
"HttpServletRequest doesn't have pathInfo. But it can implicitly convert to RichRequest.
I'm going to call RichRequest.servletRequestToRichRequest, and then call pathInfo on the result of that." */
class RichRequest(req: HttpServletRequest) extends Request {
def pathInfo = req.getPathInfo
}
object RichRequest {
implicit def servletRequestToRichRequest(req: HttpServletRequest) = new RichRequest(request)