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 / 0_reuse_code.js
Created October 11, 2013 16:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim: ai ts=4 sts=4 et sw=4
# Autor: Hector Miuler Malpica Gallegos
# Email: miuler@gmail.com
# Rev: $Rev
# -------------------------------------------------------------------
# https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators
import play.api.libs.json._
import play.api.libs.functional.syntax._
import play.api.data.validation._
implicit def tuple2Reads[A, B](implicit aReads: Reads[A], bReads: Reads[B]): Reads[Tuple2[A, B]] = Reads[Tuple2[A, B]] {
case JsArray(arr) if arr.size == 2 => for {
a <- aReads.reads(arr(0))
b <- bReads.reads(arr(1))
} yield (a, b)
case _ => JsError(Seq(JsPath() -> Seq(ValidationError("Expected array of two elements"))))
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
@Miuler
Miuler / gist:5199945
Last active December 15, 2015 04:09
Temporal log
LOG_COMPLETO
/home/miuler/java/apache-tomcat-6.0.36/bin/catalina.sh run
Using CATALINA_BASE: /home/miuler/.IntelliJIdea12/system/tomcat/Unnamed_dsm-webapp
Using CATALINA_HOME: /home/miuler/java/apache-tomcat-6.0.36
Using CATALINA_TMPDIR: /home/miuler/java/apache-tomcat-6.0.36/temp
Using JRE_HOME: /usr/lib/jvm/java-6-openjdk
Using CLASSPATH: /home/miuler/java/apache-tomcat-6.0.36/bin/bootstrap.jar
[2013-03-20 01:42:25,743] Artifact dsm-webapp:war exploded: Server is not connected. Press 'Deploy' to start deployment.
Connected to the target VM, address: '127.0.0.1:55706', transport: 'socket'
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
@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 = {
@Miuler
Miuler / notify_hg.sh
Created November 7, 2012 18:36
Script para notificar de nuevos cambios en un repositorio hg
#!/bin/bash
verificar_hg() {
cd /home/miuler/aep-dsm/$1
#mensaje=`hg -q in --template '{author|user} :: {desc|firstline|strip}\n------------------------------------------------------------\n'`
#mensaje=`hg in | tail -n +2`
mensaje=`hg in | tail -n +2|sed -r s/revision/---------------------------------------------\\\nrevision/`
if [ -n "$mensaje" ]
then
@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()) {
@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.