Skip to content

Instantly share code, notes, and snippets.

View cjauvin's full-sized avatar

Christian Jauvin cjauvin

View GitHub Profile
val pairs = sc.parallelize(List(("aa", 1), ("bb", 2),
("aa", 10), ("bb", 20),
("aa", 100), ("bb", 200)))
/* aggregateByKey takes an initial accumulator (here an empty list),
a first lambda function to merge a value to an accumulator, and a
second lambda function to merge two accumulators */
pairs.aggregateByKey(List[Any]())(
(aggr, value) => aggr ::: (value :: Nil),
(aggr1, aggr2) => aggr1 ::: aggr2
(setq my-helm-source-file-buffers-list
(helm-make-source "Files" 'my-helm-source-file-buffers-class)
my-helm-source-nonfile-buffers-list
(helm-make-source "Buffers" 'my-helm-source-nonfile-buffers-class))
(setq helm-mini-default-sources '(my-helm-source-file-buffers-list
my-helm-source-nonfile-buffers-list
helm-source-recentf
helm-source-buffer-not-found))
import re
from colorama import Back, Fore, Style
def shingles(s, k):
ts = set()
for i in range(len(s) - k + 1):
t = s[i:i+k]
ts.add(t)
return ts
drop table if exists succursale_saq cascade;
create table succursale_saq (
no_succursale_saq text primary key, -- text to allow searching
adresse text,
ville text
);
drop table if exists representant cascade;
create table representant (
representant_id serial primary key,
$ echo 'echo "hello!"' >> hello.sh
$ chmod u+x hello.sh
$ ./hello.sh
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import random
from hashlib import md5, sha1
from collections import defaultdict
from scipy.stats import hmean
import numpy as np
import redis
import sys
def get_n_zeros(v, n_bits=128, from_right=True):
"""Get number of trailing or leading 0s in the binary
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.