Skip to content

Instantly share code, notes, and snippets.

View filippovitale's full-sized avatar

Filippo Vitale filippovitale

View GitHub Profile
@oxbowlakes
oxbowlakes / 3nightclubs.scala
Created May 13, 2011 15:14
A Tale of 3 Nightclubs
/**
* Part Zero : 10:15 Saturday Night
*
* (In which we will see how to let the type system help you handle failure)...
*
* First let's define a domain. (All the following requires scala 2.9.x and scalaz 6.0)
*/
import scalaz._
import Scalaz._
@ryanmark
ryanmark / responsive-screens.js
Created March 5, 2012 15:59
Easy responsive screenshots with Phantom.js
/*
* Take a set of full height screenshots for a range of screensizes.
* phantomjs responsive-screens.js http://www.cnn.com/ png
*
* This will create a directory tree in your current directory which
* mirrors the URL. All files will be named with the current time.
* You can run this on a cron to build an archive of screenshots.
**/
var page = new WebPage(),
@derpston
derpston / cursestest.py
Created April 11, 2012 17:56
Python curses example
# Scatters dots randomly on your terminal as a quick demo of curses.
import curses
import random
import time
window = curses.initscr()
try:
(h, w) = window.getmaxyx()
@gatlin
gatlin / uninstall-haskell-osx.sh
Last active April 11, 2024 22:31
Uninstall Haskell from Mac OS X
#!/bin/bash
# source: http://www.haskell.org/pipermail/haskell-cafe/2011-March/090170.html
sudo rm -rf /Library/Frameworks/GHC.framework
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework
sudo rm -rf /Library/Haskell
rm -rf ~/.cabal
rm -rf ~/.ghc
rm -rf ~/Library/Haskell
@arosien
arosien / runar-io-free.scala
Last active September 10, 2016 07:17
Translation of Runar's ScalaIO 2013 presentation on IO and Free monads (http://blog.higher-order.com/assets/scalaio.pdf) to scalaz.
import scalaz._
import Scalaz._
import Free._
/** "Pure" interactions with a console. */
sealed trait Console[+A]
case class GetLine[A](k: String => A) extends Console[A]
case class PutLine[A](s: String, a: A) extends Console[A]
object Console {
@debasishg
debasishg / gist:8172796
Last active March 15, 2024 15:05
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
@gak
gak / gist:8537275
Created January 21, 2014 09:51
dude
void main(void)
{
float x,y;
float ratio = iResolution.y / iResolution.x;
x = gl_FragCoord.x / iResolution.x - 0.5;
y = gl_FragCoord.y / iResolution.y * ratio - 0.25;
float PI = 3.14159265358979323846264;
/**
* Original source:
* [[https://gist.github.com/oxbowlakes/970717]]
*
* Modifications:
* - use scala 7.0.5
* - use toValidationNel
* - use sequenceU and traverseU instead of the lambda trick
*
* Part Zero : 10:15 Saturday Night
import scalaz._
import scala.util.Try
final class X {
val magic: Int = scala.util.Random.nextInt(10000)
def isStable: Boolean = magic == 42
}
object Main extends App {
@vrischmann
vrischmann / .credentials
Last active January 20, 2023 11:57
Running SBT with a Nexus proxy with authentication
realm=Sonatype Nexus Repository Manager
host=nexus.company.com
user=admin
password=admin123