Skip to content

Instantly share code, notes, and snippets.

View soscler's full-sized avatar
🤖
🙂

Chriss Santi soscler

🤖
🙂
View GitHub Profile
from source import cosineFile as cosine
import os
k = 1
repoTrain = "/home/chriss/Desktop/Semestre6/tal/tp3/TP02-textclassif/train/"
def categorize(A):
tableau = {}
for filename in os.listdir(repoTrain):
@soscler
soscler / cassandra.env
Last active March 5, 2019 14:01
cassandra dependencies
--conf spark.cassandra.connection.host=cassandra \
--packages datastax:spark-cassandra-connector:2.4.0-s_2.11 \
--repositories https://dl.bintray.com/spark-packages/maven/ \
@soscler
soscler / docker-compose-kafka.yml
Created March 21, 2019 23:00
single node kafka service
version: "3.5"
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
container_name: zookeeper
ports:
- 2181:2181
@soscler
soscler / kafka.env
Created March 21, 2019 23:00
single node kafka env-file
KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
KAFKA_ADVERTISED_HOST_NAME=kafka
KAFKA_BROKER_ID=1
KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME=PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
KAFKA_CREATE_TOPICS=topic1:1:1
@soscler
soscler / consumer.py
Last active March 24, 2019 17:06
kafka consumer
from kafka import KafkaConsumer
topic = 'topic1'
server = 'localhost:9092'
groupId = 'DemoConsumer'
print("Inside consume method...")
@soscler
soscler / sampleKafkaConsumer.py
Last active March 24, 2019 17:06
kafka consumer in python
from kafka import KafkaConsumer
from threading import Thread
import threading
import time
# To consume latest messages and auto-commit offsets
class Consumer(Thread):
@soscler
soscler / fluid.c
Created March 26, 2019 16:47
simple fluid simulation
// Usage: Drag with the mouse to add smoke to the fluid. This will also move a "rotor" that disturbs
// the velocity field at the mouse location. Press the indicated keys to change options
//--------------------------------------------------------------------------------------------------
#include <rfftw.h> //the numerical simulation FFTW library
#include <stdio.h> //for printing the help text
#include <math.h> //for various math functions
#include <GL/glut.h> //the GLUT graphics library
@soscler
soscler / rectangle.c
Last active April 25, 2019 22:26
Rectangle and circle drawing with opengl (glut)
#include<stdio.h>
#include<stdlib.h>
#include "libgraphique.h"
#define x0 200 /* origine grille X */
#define y0 100 /* origine grille Y */
#define LARGEUR 8 /* nombre de cases en largeur d'une grille */
#define HAUTEUR 8 /* nombre de cases en largeur d'une grille */
#define COTE 50 /* nombre de pixels d'un cote d'une case de la grille */
#define RAYON 15 /* rayon du disque representant le curseur */
@soscler
soscler / zebra-puzzle.md
Created May 15, 2019 11:51
Zebra puzzle

The puzzle of Lewis Carroll:

A small street has five differently coloured houses on it. Five men of different nationalities live in these five houses. Each man has a different profession, each man likes a different drink, and each has a different pet animal. We have the following information:

  • The Englishman lives in the red house.
  • The Spaniard has a dog.
import sys
def solve(n,p,s):
s = sorted(s, reverse=True)
min_time = sys.maxsize
for i in range(n - p + 1):
sub = s[i:i+p]
sub_time = p * s[i] - sum(sub)
if(sub_time <= min_time):
min_time = sub_time