Skip to content

Instantly share code, notes, and snippets.

View jersub's full-sized avatar

Jérémy Subtil jersub

View GitHub Profile
@freeman-lab
freeman-lab / StreamingKMeans.scala
Last active February 26, 2019 07:13
Spark Streaming + MLLib integration examples
package thunder.streaming
import org.apache.spark.{SparkConf, Logging}
import org.apache.spark.rdd.RDD
import org.apache.spark.SparkContext._
import org.apache.spark.streaming._
import org.apache.spark.streaming.dstream.DStream
import org.apache.spark.mllib.clustering.KMeansModel
import scala.util.Random.nextDouble
@jersub
jersub / gist:7869100
Created December 9, 2013 08:31
Unlock Chromium's SQLite databases when your profile is corrupted. From kyron: http://www.google.com/support/forum/p/Chrome/thread?fid=46cbd32bea7f4fec00048665de6e82de&hl=en
IFS="
"
for I in `file ~/.config/chromium/Default/*|grep SQL|cut -f1 -d:`; do echo '.dump' | sqlite3 $I > ${I}.sql && rm $I && sqlite3 $I < ${I}.sql && rm ${I}.sql ; done
@massie
massie / KryoRegistrator.scala
Created October 29, 2013 23:59
Here's an example of how to embed Avro objects into a Kryo stream. You only need to register each Avro Specific class in the KryoRegistrator using the AvroSerializer class below and you're ready to go.
/*
* Copyright (c) 2013. Regents of the University of California
*
* Licensed 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
*
* Unless required by applicable law or agreed to in writing, software
@renoirb
renoirb / init.yml
Last active March 30, 2023 03:15
How to install Oracle Java from ppa webupd8team/java using Salt stack, in ONE state file
#
# How to install automatically Oracle Java 7 under Salt Stack
#
# Thanks Oracle for complicating things :(
#
# 1. Create a java/ folder in your salt master
# 2. Paste this file in init.sls
# 3. salt '*' state.sls java
#
# Source:
@jersub
jersub / gist:3772965
Created September 23, 2012 20:34
SSL CSR generation
openssl genrsa -out domain.com.key 2048
openssl req -new -keydomain.com.key.key -out domain.com.csr
@ZJONSSON
ZJONSSON / d3.layout.force3d.js
Created May 17, 2012 18:21
d3.layout.force3d (a quick hack to get force layout into the third dimension)
(function() {
// D3.layout.force3d.js
// (C) 2012 [email protected]
// BSD license (http://opensource.org/licenses/BSD-3-Clause)
d3.layout.force3d = function() {
var forceXY = d3.layout.force()
,forceZ = d3.layout.force()
,zNodes = {}
,zLinks = {}
@jersub
jersub / fabfile.py
Created September 26, 2011 21:43
Management of multiple gallery3 instances with Fabric
import os
import re
from fabric.api import lcd, hide, local, puts
CONTRIB_DIR = 'gallery-contrib'
GALLERY_REPO = 'git://github.com/gallery/gallery3.git'
GALLERY_CONTRIB_REPO = 'git://github.com/gallery/gallery3-contrib.git'
DATABASE_PREFIX = 'gallery_'
@shapeshed
shapeshed / unicorn
Created September 16, 2011 10:12
Unicorn / Monit setup
#!/bin/sh
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
TIMEOUT=${TIMEOUT-60}
APP_ROOT=/path/to/your/app/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENVIRONMENT=production
@jersub
jersub / Makefile
Created May 12, 2011 19:01
Set of Bazaar scripts for another agile development process.
BIN=agile_create-repo agile_update-mirrors
PREFIX=/usr/local
install:
@install -v $(BIN) $(PREFIX)/bin
uninstall:
@for bin in $(BIN); do \
rm -fv $(PREFIX)/bin/$$bin; \
done;
@jersub
jersub / 60-lxc.conf
Created May 7, 2011 11:18 — forked from pklaus/create-lxc-container.sh
Automates the steps to set up LXC containers with virtualized environments on Ubuntu Linux
net.ipv4.ip_forward=1
net.ipv4.conf.eth0.proxy_arp=1