Skip to content

Instantly share code, notes, and snippets.

View pablete's full-sized avatar

Pablo A. Delgado pablete

View GitHub Profile
@pablete
pablete / example.css
Last active December 24, 2016 15:23 — forked from dk8996/example.css
D3.js Gantt Chart, example 3
html,body,#wrapper {
width: 100%;
height: 100%;
margin: 0px;
}
.chart {
font-family: Arial, sans-serif;
font-size: 12px;
}
""" Poisson-loss Factorization Machines with Numba
Follows the vanilla FM model from:
Steffen Rendle (2012): Factorization Machines with libFM.
In: ACM Trans. Intell. Syst. Technol., 3(3), May.
http://doi.acm.org/10.1145/2168752.2168771
See also: https://github.com/coreylynch/pyFM
"""
@pablete
pablete / Inject VelocityJS
Last active August 29, 2015 14:27 — forked from painteddigital/Inject VelocityJS
Paste this into your console to play with velocity on a page that doesn't have it. It assumes jQuery exists already
(function() {
var url = ["cdn.jsdelivr.net/velocity/1.1.0/velocity.min.js","cdn.jsdelivr.net/velocity/1.1.0/velocity.ui.min.js"];
for(var i=0; i < url.length; i++){
var v = document.createElement('script'); v.type = 'text/javascript'; v.async = true;
v.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + url[i];
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(v, s);
}
})();
val conf = new SparkConf().setAppName("Simple Application")
val sc = new SparkContext(conf)
val hadoopConf=sc.hadoopConfiguration;
hadoopConf.set("fs.s3.impl","org.apache.hadoop.fs.s3native.NativeS3FileSystem")
hadoopConf.set("fs.s3.awsAccessKeyId", myAccessKey)
hadoopConf.set("fs.s3.awsSecretAccessKey", mySecretKey)
//Also
hadoopConf.set("fs.s3.awsAccessKeyId", System.getProperty("awsAccessKeyId"))
hadoopConf.set("fs.s3.awsSecretAccessKey", System.getProperty("awsSecretAccessKey"))
from locust import HttpLocust, TaskSet, task
import json
import os
json_data=open(os.path.dirname(os.path.abspath(__file__)) + "/small_payload.json").read()
data = json.loads(json_data)
class MyTaskSet(TaskSet):
@task
def my_task(self):
@pablete
pablete / README.md
Last active August 29, 2015 14:18 — forked from mbostock/.block
@pablete
pablete / index.html
Last active August 29, 2015 14:18 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var width = 960,
height = 500;
var colors = [
public void trackGoal(String goalName, String trackingId, Map<String,String> analyticsArguments) {
final Options options = new Options().setAnonymousId(trackingId);
final Props p = new Properties("properties");
for(KeyVal e : analyticsArguments.getKeyVal()) {
p.put(e.key(), e.val())
}
analyticsClient.track("anonymous", goalName, props, options);
}
public void Publish(IEnumerable<Reservation> reservations, out int nextWaterMark)
{
nextWaterMark = 0;
using (IRabbitMqClient client = _clientFactory())
{
var channel = client.GetChannel();
foreach (var reservation in reservations)
{
Analytics.track(
userID,
“search_availability”,
new Props().put(“metro_id”, 4),
new Options().setAnonymousId(trackingId));