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 / 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
@Miuler
Miuler / UTF8Control.java
Created March 28, 2012 22:53
Clase de java para poder manejar los properties con UTF-8
package pe.gob.mef.banco_proyectos.commons.util;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Locale;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
@Miuler
Miuler / .hgrc
Created April 11, 2012 17:18
Mi configuración para el mercurial
[ui]
username = Hector Miuler Malpica Gallegos <miuler@gmail.com>
[extensions]
churn =
convert =
rebase =
purge =
progress =
graphlog =
#! /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()
import smtpd
import asyncore
class FakeSMTPServer(smtpd.SMTPServer):
__version__ = 'TEST EMAIL SERVER'
def process_message(self, peer, mailfrom, rcpttos, data):
print 'Receiving message from:', peer
print 'Message addressed from:', mailfrom
print 'Message addressed to :', rcpttos
@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 / plugins.sbt
Created September 15, 2012 17:01
HOME/.sbt/plugins/plugins.sbt
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")
resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0-SNAPSHOT")
@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 / OSValidator.java
Created November 3, 2012 04:50
Detectar que SO se esta usando desde java
public class OSValidator {
 
public static void main(String[] args) {
if (isWindows()) {
System.out.println("This is Windows");
} else if (isMac()) {
System.out.println("This is Mac");
} else if (isUnix()) {
System.out.println("This is Unix or Linux");
} else if (isSolaris()) {