Skip to content

Instantly share code, notes, and snippets.

View fede-vaccaro's full-sized avatar

Federico Vaccaro fede-vaccaro

  • Italy
View GitHub Profile
import os
import random
import shutil
import cv2
import matplotlib.pyplot as plt
import networkx
import numpy as np
import paths
from networkx import (
@fede-vaccaro
fede-vaccaro / Test.java
Last active September 28, 2019 11:21
Testing with Docker - PostgreSQL
@Before
public void createUserRepository() {
entityManager.getTransaction().begin();
entityManager.createNativeQuery("do\n" +
"$$\n" +
"declare\n" +
" l_stmt text;\n" +
"begin\n" +
" select 'truncate ' || string_agg(format('%I.%I', schemaname, tablename), ',')\n" +
" into l_stmt\n" +
@fede-vaccaro
fede-vaccaro / docker-compose.yml
Created September 24, 2019 18:47
docker compose for postgre + adminer
version: "2"
services:
db:
image: postgres:10
restart: always
ports:
- 5432:5432
environment:
POSTGRES_USER: docker
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include "cuda_runtime_api.h"
// useful defines
#ifndef USEFULDEFINES
#define USEFULDEFINES
#define Mask_width 3
#define Mask_radius Mask_width / 2
#define TILE_WIDTH 16
@fede-vaccaro
fede-vaccaro / numpy_bench.py
Last active December 4, 2018 15:49
Numpy benchmark over LA ops.
from __future__ import print_function
import numpy as np
from time import time
# Let's take the randomness out of random numbers (for reproducibility)
np.random.seed(0)
# THIS SCRIPT ISN'T MINE AT ALL: I JUST FOUND IT ON REDDIT.
# Useful to benchmark.
@fede-vaccaro
fede-vaccaro / python_bench.py
Last active February 23, 2018 12:03
a python benchmark over certain operation.
import sys
import numpy as np
import numpy.linalg as LA
import scipy.linalg
from sklearn.mixture import GaussianMixture
from sklearn.preprocessing import normalize
from sklearn.decomposition import PCA
from multiprocessing.dummy import Pool as ThreadPool
import time