Skip to content

Instantly share code, notes, and snippets.

Alex Gonzalez Lacasa aloon

Block or report user

Report or block aloon

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
rjz /
Created Aug 9, 2016
Get ngrok hostname from command line
# ngrok's web interface is HTML, but configuration is bootstrapped as a JSON
# string. We can hack out the forwarded hostname by extracting the next
# `*` string from the JSON
# Brittle as all get out--YMMV. If you're still reading, usage is:
# $ ./ <proto> <addr>
chrismdp /
Last active Mar 8, 2020
Uploading to S3 in 18 lines of Shell (used to upload builds for
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (
# Based on a modified script from here:
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
pathikrit / SudokuSolver.scala
Last active Feb 14, 2020
Sudoku Solver in Scala
View SudokuSolver.scala
val n = 9
val s = Math.sqrt(n).toInt
type Board = IndexedSeq[IndexedSeq[Int]]
def solve(board: Board, cell: Int = 0): Option[Board] = (cell%n, cell/n) match {
case (r, `n`) => Some(board)
case (r, c) if board(r)(c) > 0 => solve(board, cell + 1)
case (r, c) =>
def cells(i: Int) = Seq(board(r)(i), board(i)(c), board(s*(r/s) + i/s)(s*(c/s) + i%s))
def guess(x: Int) = solve(board.updated(r, board(r).updated(c, x)), cell + 1)
thesamet / ReverseProxy.scala
Created Nov 5, 2014
Reverse-proxy in Play!
View ReverseProxy.scala
def reverseProxy = Action.async(parse.raw) {
request: Request[RawBuffer] =>
// Create the request to the upstream server:
val proxyRequest =
WS.url("http://localhost:8887" + request.path)
.withHeaders(flattenMultiMap(request.headers.toMap): _*)
.withQueryString(request.queryString.mapValues(_.head).toSeq: _*)
staltz /
Last active Apr 1, 2020
The introduction to Reactive Programming you've been missing
ian-kent / Authentication.scala
Created Feb 11, 2014
Akka based authentication and authorisation for Play Framework
View Authentication.scala
package wrappers
import play.api._
import play.api.mvc._
import scala.concurrent._
import scala.concurrent.Future
import play.mvc.Http.Status
import play.libs.Akka
import{Actor, Props}
View gist:6535332
package com.varun.perculator;
import java.util.ArrayList;
import java.util.List;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.core.SimpleAnalyzer;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.memory.MemoryIndex;
import org.apache.lucene.queryparser.classic.ParseException;
groundwater / Application.scala
Created Aug 24, 2012
Action that parses protocol buffers
View Application.scala
object Put extends Controller {
def index = DecodeProtobuf(classOf[MyProtobuf]) { stack :MyProtobuf =>
Action {
// do something with stack
digal / Dimensions.scala
Created Apr 3, 2011
Scala DSL for simple imagemagick-styles geometry strings
View Dimensions.scala
* DSL for imagemagick-style geometry strings
* See for description
* Note: offesets are not supported
* Implements following constructs
* <width> x <height> - Rect
* <Rect> <Qualifier> (where qualifier is !/%/>/<) - Geometry
You can’t perform that action at this time.