This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import time | |
inicio = time() | |
print ( amazonInvPairsRDD | |
.join( googleInvPairsRDD ) | |
.map( lambda (a,b): (b,a)) | |
.reduceByKey(lambda tok1, tok2: [tok1, tok2] ) | |
).count() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
NewerOlder