Skip to content

Instantly share code, notes, and snippets.

View jsoriano's full-sized avatar

Jaime Soriano Pastor jsoriano

View GitHub Profile
@jsoriano
jsoriano / status_integration_test_opt1.go
Last active November 22, 2018 13:25
Metricbeat integration tests revamp, code style
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
@jsoriano
jsoriano / server.go
Created April 9, 2015 22:24
Testing a simple go-martini application with mocks
package mditest
import (
"fmt"
"net/http"
"github.com/go-martini/martini"
redis "gopkg.in/redis.v2"
)
@jsoriano
jsoriano / staged-versions-libgit2.c
Last active August 29, 2015 14:07
Script to reproduce libgit2#2515
#include <stdio.h>
#include <git2.h>
int main(int argc, char *argv[]) {
int error;
git_repository *repo = NULL;
git_checkout_options options = GIT_CHECKOUT_OPTIONS_INIT;
git_threads_init();

Keybase proof

I hereby claim:

  • I am jsoriano on github.
  • I am jsoriano (https://keybase.io/jsoriano) on keybase.
  • I have a public key whose fingerprint is 2B96 B993 FF0B 3865 510D 2FA6 A5D7 6B49 9AA3 67BB

To claim this, I am signing this object:

@jsoriano
jsoriano / jenkins_job_times.py
Created April 25, 2014 11:41
Retrieves duration of jenkins executions of a job as a CSV
import argparse
import getpass
import json
import requests
def parse_arguments():
parser = argparse.ArgumentParser(
description="Get duration of jenkins jobs along its executions")
parser.add_argument('job_url', metavar='JOB_URL')
@jsoriano
jsoriano / ebt.go
Last active August 29, 2015 13:56
Some exercises of go tour
// Equivalent Binary Trees
package main
import "code.google.com/p/go-tour/tree"
import "fmt"
func Walk(t *tree.Tree, ch chan int) {
defer close(ch)
var walk func(t *tree.Tree)
@jsoriano
jsoriano / Vagrantfile
Last active July 14, 2016 15:00
Small example with vagrant, docker and Digital Ocean
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Quick start:
# - vagrant plugin install vagrant-digitalocean
# - Set-up ~/.digital_ocean.rb like this:
# module DigitalOceanKeys
# CLIENT_ID = 'foooooooo'
# API_KEY = 'fabada'
# end
@jsoriano
jsoriano / hg-truncate-and-sync.sh
Created December 30, 2013 09:48
Uses hg convert to truncate a repository from an initial revision. If no revision is specified, the whole repository is converted. It optionally uses an intermediate repository (cache) in case the source repository can be written during the convert operation.
#!/bin/bash
#
# Uses hg convert to strip a repository from <start revision>
# If no revision is specified, the whole repository is converted.
# Optionally a "cache" repository can be used, to be sure that the
# source repository is not written during the convert operation.
#
while getopts "r:s:d:c:h?" opt; do
case $opt in
@jsoriano
jsoriano / foo.pp
Created July 24, 2013 15:09
Concatenate arrays that are parameters of resources in puppet without the use of ruby code
class foo ($concatenate = []) {
class simple_resource {
exec { 'env':
command => 'env | sort',
path => '/usr/bin',
environment => ['FOO=bar'],
logoutput => true,
}
}
@jsoriano
jsoriano / closure.hs
Last active December 14, 2015 20:39
Closures that modify a variable of these scopes in different languages
module Main (main) where
import Debug.Trace
import Control.DeepSeq
import Control.Monad.State
type Counter = State Int ()
log' :: Counter -> Counter
log' f = do f