Skip to content

Instantly share code, notes, and snippets.

View Miuler's full-sized avatar
🦀
Mi nueva pacion, Rust!

Hector Miuler Malpica Gallegos Miuler

🦀
Mi nueva pacion, Rust!
View GitHub Profile
@Miuler
Miuler / .ctags
Created January 2, 2012 02:14 — forked from anonymous/.ctags
--langdef=Scala
--langmap=Scala:.scala
--regex-Scala=/^[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/c,classes/
--regex-Scala=/^[ \t]*object[ \t]*([a-zA-Z0-9_]+)/\1/o,objects/
--regex-Scala=/^[ \t]*trait[ \t]*([a-zA-Z0-9_]+)/\1/t,traits/
--regex-Scala=/^[ \t]*case[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/r,cclasses/
--regex-Scala=/^[ \t]*abstract[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/a,aclasses/
--regex-Scala=/^[ \t]*def[ \t]*([a-zA-Z0-9_=]+)[ \t]*.*[:=]/\1/m,methods/
--regex-Scala=/[ \t]*val[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/V,values/
--regex-Scala=/[ \t]*var[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/v,variables/
@Miuler
Miuler / gist:1836786
Created February 15, 2012 15:46 — forked from wspringer/gist:1649700
LZW Encoding *and Decoding* in Scala
object lzw {
trait Appendable[T] {
def append(value: T)
}
import scala.collection.generic._
case class GrowingAppendable[T](growable: Growable[T]) extends Appendable[T] {
def append(value: T) {
growable += value
@Miuler
Miuler / gist:1836791
Created February 15, 2012 15:47 — forked from wspringer/gist:1649700
LZW Encoding *and Decoding* in Scala
object lzw {
trait Appendable[T] {
def append(value: T)
}
import scala.collection.generic._
case class GrowingAppendable[T](growable: Growable[T]) extends Appendable[T] {
def append(value: T) {
growable += value
@Miuler
Miuler / meow.scala
Created February 15, 2012 20:38 — forked from devth/meow.scala
object =^ { def ^= = "meow" }
// defined module $eq$up
=^.^=
// res10: java.lang.String = meow
#! /usr/bin/env python
import fileinput
import argparse
from operator import itemgetter
parser = argparse.ArgumentParser()
parser.add_argument('--target-mb', action = 'store', dest = 'target_mb', default = 61000, type = int)
parser.add_argument('vmtouch_output_file', action = 'store', nargs = '+')
args = parser.parse_args()
@Miuler
Miuler / play.conf
Created July 25, 2012 16:02 — forked from leon/play.conf
Upstart script for Play Framework 2.0
###################################################################################
# /etc/init/play.conf
# Upstart script for a play application that binds to an unprivileged user.
# put this into a file like /etc/init/play.conf
#
# This could be the foundation for pushing play apps to the server using something like git-deploy
# By calling service play stop in the restart command and play-start in the restart command.
#
# Usage:
@Miuler
Miuler / A-Objective.txt
Created September 26, 2012 17:53 — forked from ckirkendall/A-Objective.txt
Adventures in Type Theory: Parametric Polymorphism(Generics) vs Type Classes (Java,Scala,C#,F#,Nemerle,Haskell)
The Objective
This language experiment was designed to show how parametric polymorphism and type classes are implemented in
different languages. The implementation languages where chosen out of personal preference. I am well aware it's not
complete and would love for you to help me with that. If you don't see your favorite language please add it as
a comment. I am also not an expert in all of these languages but did try to make them as idiomatic as possible.
If you believe there is a better solution please leave a comment with the implementation.
Personal Takeaways:
* ML based languages provide very terse and readable code, when compared to C based syntax.
@Miuler
Miuler / gist:4134020
Created November 23, 2012 04:36
Benchmarks for Gatling: Gatling's simulation
package jmeter
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import com.excilys.ebi.gatling.http.Headers.Names._
import bootstrap._
class JMeterBenchmark extends Simulation {
def apply = {
The basic idea here is to substantiate the claims made by this square post:
http://corner.squareup.com/2011/06/postgresql-data-is-important.html
In PostgreSQL, and MySQL (MyISAM and InnoDB) I create millions of rows and then add
and remove columns and add and remove indexes. For columns without defaults this is
basically free in PostgreSQL and O(n) in MySQL. For adding indexes its at best O(n)
everywhere, but with PostgreSQL it claims not to do any locking that would otherwise
prevent table interaction.
Also, PostgreSQL has _awsome_ documentation (it has real examples!). I always get
import scala.collection._
import com.twitter.util._
scala> val buffer = mutable.ArrayBuffer.empty[Int]
scala> println(Time.measure { (0 to 50000000).foreach { buffer += _ } }.inMillis)
17610
scala> var vector = immutable.Vector.empty[Int]
scala> println(Time.measure { (0 to 50000000).foreach { vector :+= _ } }.inMillis)
7865