Skip to content

Instantly share code, notes, and snippets.

View bertini36's full-sized avatar
🌚

Alberto Pou bertini36

🌚
View GitHub Profile
# Find topics of politicians
make run_all timelines=Albert_Rivera,sanchezcastejon,Pablo_Iglesias_,pablocasado_ n_topics=5
# -*- coding: UTF-8 -*-
"""
Linear regression using Autograd
"""
import autograd.numpy as np
import matplotlib.pyplot as plt
from autograd import elementwise_grad
# -*- coding: UTF-8 -*-
"""
Linear regression using Tensorflow
"""
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* MULTI-NODE AND PARALLEL MATRIX-MATRIX PRODUCT WITH MPI AND CUDA */
/* */
/* File: mmpmpicuda.cu */
/* Author: Alberto Pou Quirós (Github: bertini36) */
/* Description: This program performs a matrix product (A * B = C) */
/* distributing the computation between multiple nodes */
/* with MPI technology and parallelizing the computation in */
/* every node with Nvidia CUDA technology */
/* Compilation: nvcc -I/opt/mpi/bullxmpi/1.2.9.1/include */
/**
* Created by Xisco Sastre & Alberto Pou
*/
import com.spark.streaming.StreamingLogger
import org.apache.spark._
import org.apache.spark.streaming._
import org.apache.spark.streaming.twitter._
import com.datastax.spark.connector.cql.CassandraConnector
from django.db import connection
from customers.models import Client
from contacts.models import Contact
tenant = Client.objects.get(name='Tenant 1')
connection.set_tenant(tenant)
# Ahora estamos conectados al Tenant 1.
# Todas las consultas a BD se realizarán sobre el esquema tenant1
contacts = Contact.objects.all()
# -*- coding: UTF-8 -*-
from rest_framework import serializers
from rest_framework import viewsets
from contacts.models import Contact
class ContactSerializer(serializers.ModelSerializer):
class Meta:
tenant = Client(domain_url='tenant1.saas.com',
schema_name='tenant1',
name='Tenant1',
paid_until='2014-12-05',
on_trial=True)
tenant.save()
# -*- coding: UTF-8 -*-
from django.db import models
class Contact(models.Model):
name = models.CharField(max_length=64)
surnames = models.CharField(max_length=128)
email = models.EmailField()
phone_number = models.CharField(max_length=64)
tenant = Client(domain_url='public.saas.com',
schema_name='public',
name='Public',
paid_until='2014-12-05',
on_trial=True)
tenant.save()