Skip to content

Instantly share code, notes, and snippets.

View alexy's full-sized avatar

Alexy Khrabrov alexy

View GitHub Profile
@milessabin
milessabin / gist:6707525
Created September 25, 2013 23:14
New in shapeless 2.0.0-SNAPSHOT (post M1): lazy recursive implicit values ... normally you would expect the recursion between List[T] and Cons[T] to cause the implicit resolution for Show[T] to blow up with a diverging implicit expansion.
import shapeless._
sealed trait List[+T]
case class Cons[T](hd: T, tl: List[T]) extends List[T]
sealed trait Nil extends List[Nothing]
case object Nil extends Nil
trait Show[T] {
def apply(t: T): String
}
@luajalla
luajalla / Console.fs
Created October 10, 2013 19:52
REngine initialization (Mono + OSX, R 2.15 32bit) - Console app works - Type provider crashes (added a script file with #r to it)
namespace rtest
open System
open RDotNet
[<AutoOpen>]
module Init =
let initR() =
let rpath = "/Library/Frameworks/R.framework/Libraries"
let rresources = "/Library/Frameworks/R.framework/Resources"
@russch
russch / gist:7451465
Created November 13, 2013 15:59
Automatically refresh a Tableau viz on Tableau Server
<!DOCTYPE html>
<html>
<title>I'm an HTML file!</title>
<!-- Replace the reference to the JS API on Tableau Public to your server -->
<script type="text/javascript" src="http://public.tableausoftware.com/javascripts/api/tableau_v8.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
#!/bin/bash
# tungsten-slave-createcachetables.sh
# Tungsten is not extracting data for the following pattern (Drupal 6 and 7):
# replicator.filter.replicate.ignore=*.access,*.cache,*.cache_*,*.ctools_*_cache,*.views_*_cache,*.sessions,*.watchdog
# This means that the tables would not exist on the slave. It would be ideal to have
# the tables exist, but be empty.
# This script will create empty tables for any table matching the pattern in 'grep' commands below.
# It is manually set to match the same replicator.filter.replicate.ignore in the tungsten config.
class Deps {
// scala language dependencies
def scalaCompiler = scalaVersion map ("org.scala-lang" % "scala-compiler" % _)
def scalaReflect = scalaVersion map ("org.scala-lang" % "scala-reflect" % _)
def scalaParsers = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1"
def scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.0.2"
// java dependencies
def ant = "org.apache.ant" % "ant" % "1.9.4"
def asm = "org.ow2.asm" % "asm-debug-all" % "5.0.1"
@jonathantneal
jonathantneal / README.md
Last active March 24, 2025 17:47
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
import Foundation
extension String
{
var length: Int {
get {
return countElements(self)
}
}
@ceteri
ceteri / 0.setup.sh
Last active April 24, 2019 11:04
Spark Streaming demo
# using four part files to construct "minitweet"
cat rawtweets/part-0000[1-3] > minitweets
# change log4j properties to WARN to reduce noise during demo
mv conf/log4j.properties.template conf/log4j.properties
vim conf/log4j.properties # Change to WARN
# launch Spark shell REPL
./bin/spark-shell
@JuPfu
JuPfu / CSVParboiledParser.scala
Last active October 29, 2015 07:20
A Scala Parboiled2 Grammar for CSV
/*
* Copyright (C) 2014 Juergen Pfundt
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
{
"named_patterns" : {
"first_equal" : " = (?:.*?[^{]$)/f",
"first_comma" : ", /f",
"first_colon" : ": /f",
"all_space" : "\\s+/l1l0",
"hocon" : ": (?:.*?[^{]$)/r1l1l1f",
"typed" : "[:]/r0c1l1f",
"bash_var" : "[$][(]|[|][|]|[)]|[#]",
"sbt_operator" : "[&|@#<+:~]+[=][ ]/r1c1l1",