Skip to content

Instantly share code, notes, and snippets.

View dahernan's full-sized avatar

David Hernandez dahernan

View GitHub Profile
@dahernan
dahernan / increase_pom.groovy
Created April 24, 2012 09:19
Groovy XML pom manipulation
/*
Script to increase the version number of the project and remove snapshots
Using Gmaven: http://docs.codehaus.org/display/GMAVEN/Executing+Groovy+Code
Execute standalone
$ mvn groovy:execute
<plugin>
<groupId>org.codehaus.gmaven</groupId>
Bash funtions
function psgrep() { ps aux | grep -v grep | grep "$@" -i --color=auto; }
function fname() { find . -iname "*$@*"; }
Who is using the port 25
$ lsof -i :25
Ports that process is using
$ lsof -p 52808|grep TCP
@dahernan
dahernan / Triplet Loss.ipynb
Created December 26, 2017 15:25 — forked from kylemcdonald/Triplet Loss.ipynb
Experimenting with triplet loss embeddings.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dahernan
dahernan / gist:fd8d6be29f5655a39989
Created March 17, 2015 11:58
LUA Redis Snowflake
$ redis-cli set sequence 1
$ redis-cli set node_id 1
-- id.lua
local epoch = 1288834974657
local seq = tonumber(redis.call('INCR', 'sequence')) % 4096
local node = tonumber(redis.call('GET', 'node_id')) % 1024
local time = redis.call('TIME')
local time41 = ((tonumber(time[1]) * 1000) + (tonumber(time[2]) / 1000)) - epoch
return (time41 * (2 ^ 22)) + (node * (2 ^ 12)) + seq
// needs node.js
// npm socket.io
// npm amqp
// rabbitmq running at localhost
var http = require('http'),
url = require('url'),
fs = require('fs'),
io = require('socket.io'),
amqp = require('amqp'),
@dahernan
dahernan / certificateKeytool.txt
Created August 10, 2011 09:11
generate self signed certificate with keytool
To generate a self-signed SSL certificate using the keytool command on Windows, Mac, or Linux:
1 Open a command prompt or terminal.
2 Run this command:
keytool -genkey -keyalg RSA -alias tomcat -keystore selfsigned.jks -validity <days> -keysize 2048
Where <days> indicate the number of days for which the certificate will be valid.
3 Enter a password for the keystore. Note this password as you require this for configuring the server.

Keybase proof

I hereby claim:

  • I am dahernan on github.
  • I am dahernan (https://keybase.io/dahernan) on keybase.
  • I have a public key whose fingerprint is DF74 80B5 424D 0DDD 96AA 9E4E 0E34 CAA0 068D E384

To claim this, I am signing this object:

$ docker run -d elasticsearch
$ docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
29fd16250848 elasticsearch:latest /bin/sh -c elasticse 32 seconds ago Up 32 seconds 9200->9200
@dahernan
dahernan / gist:6149703
Created August 4, 2013 08:32
docker images
$ docker images
REPOSITORY TAG ID CREATED SIZE
ubuntu 12.04 8dbd9e392a96 3 months ago 131.5 MB (virtual 131.5 MB)
ubuntu 12.10 b750fe79269d 4 months ago 24.65 kB (virtual 180.1 MB)
ubuntu latest 8dbd9e392a96 3 months ago 131.5 MB (virtual 131.5 MB)
ubuntu precise 8dbd9e392a96 3 months ago 131.5 MB (virtual 131.5 MB)
ubuntu quantal b750fe79269d 4 months ago 24.65 kB (virtual 180.1 MB)
elasticsearch latest ef2487bb289d 52 seconds ago 12.29 kB (virtual 558.7 MB)
@dahernan
dahernan / gist:6149626
Created August 4, 2013 07:56
elasticsearch Dockerfile
FROM ubuntu
MAINTAINER dahernan "dahernan@gmail.com"
# Java 7
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
RUN apt-get update
RUN echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
RUN apt-get install oracle-java7-installer -y