Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lvidarte's full-sized avatar

Leo Vidarte lvidarte

View GitHub Profile
@lvidarte
lvidarte / promise_demo.html
Created January 31, 2014 16:43
Promise example from jquery.com
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>promise demo</title>
<style>
div {
height: 50px;
width: 50px;
float: left;
@lvidarte
lvidarte / Dockerfile
Last active August 29, 2015 13:56
Node.js Hello World app on Ubuntu using docker
FROM ubuntu:13.10
RUN apt-get update
RUN apt-get install -y nodejs npm
ADD . /src
RUN cd /src; npm install
EXPOSE 8080
CMD ["nodejs", "/src/app.js"]
@lvidarte
lvidarte / Dockerfile
Last active August 29, 2015 13:56
mbc-playout docker image
# Dockerfile for mbc-caspa
FROM ubuntu:13.10
MAINTAINER Leonardo Vidarte, lvidarte@gmail.com
ADD . /src
RUN apt-get update; apt-get install -y git nodejs npm gettext mongodb redis-server ffmpeg
RUN ln -s /usr/bin/nodejs /usr/bin/node; mkdir -p /data/db
RUN cd /src; git clone http://github.com/inaes-tic/mbc-caspa.git
RUN cd /src/mbc-caspa; sed -i 's/beta4//' package.json; make update
ENTRYPOINT /bin/sh /src/start.sh
EXPOSE 3000
#!/bin/bash
export LANG=en_US.UTF-8
S3_LOG=/tmp/s3.log
S3_PID=/tmp/s3.pid
MMIN=30 # minutes to wait the process finish
function log()
@lvidarte
lvidarte / Products.php
Last active August 29, 2015 14:04
Models\Products.php
private function queryBuilder($params)
{
$queryBuilder = $this->conn->createQueryBuilder();
$queryBuilder
->select(
'p.id', 'p.nombre name', 'precio_ref referencePrice',
'p.categoria_id categoryId', 'precio_venta sellPrice',
'img_catalogo image', 'descripcion description',
'publicado published', 'alt imageAlt',
var files = [
'coquelux.01.08.01.tar.gz',
'coquelux.01.08.09.tar.gz',
'coquelux.01.08.100.tar.gz',
'coquelux.01.08.10.tar.gz',
'coquelux.01.08.99.tar.gz',
];
var getLatestVersion = function(files) {
var latestVersion = [0, 0, 0];
import sys
import pyinotify
from datetime import datetime
wm = pyinotify.WatchManager()
mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE
files = {}
class EventHandler(pyinotify.ProcessEvent):
#!/usr/bin/ruby
require 'mysql'
if ! ARGV[0] or ! ARGV[1]
puts "Usage: ./bench THREADS QUERIES"
abort
end
threads = ARGV[0].to_i
@lvidarte
lvidarte / tmux.txt
Created September 24, 2014 17:48
tmux cheatsheet
1.
tmux
exit [C-d]
Prefix d # detaches from session
2. Sessions
tmux new -s [name]
tmux attach
tmux ls
tmux attach -t [name]
import timeit
import hashlib
def get_hash(passwd, n=100):
hash = passwd
for i in xrange(n):
hash = hashlib.md5(hash).hexdigest()
return hash