Skip to content

Instantly share code, notes, and snippets.

View igponce's full-sized avatar
🤣
Yo me río de janeiro

Iñigo igponce

🤣
Yo me río de janeiro
View GitHub Profile
@igponce
igponce / gist:4539373
Created January 15, 2013 15:19
# Detect debian architecture inside a CHEF recice using MixLIB
# Detect debian architecture inside a CHEF recice
ml = Mixlib::ShellOut.new("dpkg --print-architecture")
ml.run_command
debian_arch = ml.stdout unless ml.error!
puts debian_arch
@igponce
igponce / gist:0b3ac09c09394edd8ba2
Created December 15, 2014 23:55
Simple database logging with triggers
-- Simple database logging to a table via Triggers (PostgresSQL)
-- Create tables --
create table tbl1 ( id integer, name varchar(20), ssn integer );
create table tbl1_logcopy ( modified date, id integer, name varchar(20), ssn integer );
-- Populate --
insert into tbl1 values ( 1, '123', 1000);
insert into tbl1 values ( 2, '234', 2000);
insert into tbl1 values ( 3, '345', 3000);
@igponce
igponce / gist:ab736de8e68c12cd3c9a
Created May 14, 2015 14:37
Remove TSV column data with regex
#!/usr/bin/env ruby
ARGF.each_line do |ll|
campos = ll.split "\t" # Separamos por tabuladores
campos[3].slice! /[\_\-](Multilink|Po|Gi)?[0-9_-]+(\.[0-9]+)?/
puts campos.join "\t"
end
@igponce
igponce / gist:2c64f9063b53866f7bac
Created June 23, 2015 13:32
Stupid way to substract a Spark RDD from another using right outer join
aaa = sc.parallelize( [1,2,3,4,5,6,7,8,9])
bbb = sc.parallelize( [1,3])
print ( aaa.map(lambda k: (k,k))
.leftOuterJoin(bbb.map(lambda k: (k,k)))
.collect() )
print ( aaa.map(lambda k: (k,k))
.leftOuterJoin(bbb.map(lambda k: (k,k)))
.filter(lambda k: k[1][1] == None)
@igponce
igponce / gist:7804bf3736d5161fe15d
Created June 24, 2015 21:20
Spark sorted vs unsorted joins timing...
from time import time
inicio = time()
print ( amazonInvPairsRDD
.join( googleInvPairsRDD )
.map( lambda (a,b): (b,a))
.reduceByKey(lambda tok1, tok2: [tok1, tok2] )
).count()
@igponce
igponce / civilSunriseSunset.R
Created April 26, 2016 10:32
R - civil Sunrise and sunset time
# Copyright (c) 2016, Iñigo Gonzalez Ponce <igponce (at) gmail>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
echo << EOF
Script de provision
--------------------
Componentes
- Open JDK 8
- SCALA 2.9
- Cassandra
[pend: zookeper]
@igponce
igponce / FindRecipes.md
Created September 27, 2017 14:45
Find recipes

File Sizes

Find empty files: find . -size 0

Files greater than 700M: (does not fit CDROM) find . -size +700M

Permissions

Keybase proof

I hereby claim:

  • I am igponce on github.
  • I am eb0la (https://keybase.io/eb0la) on keybase.
  • I have a public key ASDaBshcgc9DcnF45fcO9Dtcr79CcWHLVJtXB7TtwLGFWAo

To claim this, I am signing this object:

@igponce
igponce / docker-install-ubuntu.sh
Last active April 8, 2019 14:30
Install Docker on Ubuntu
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get -y install docker-ce
# Starting up