Skip to content

Instantly share code, notes, and snippets.

@shsdev
shsdev / simple_pseudonymization.py
Last active February 24, 2022 17:20
Simple pseudonymization of a column with name values in a pandas dataframe
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Requires pandas and numpy
# pip3 install pandas numpy
# and the Faker package:
# pip3 install Faker
from faker import Faker
import numpy as np
@shsdev
shsdev / ConcurrentExecutionUsingFutures.scala
Created March 12, 2015 14:03
Use execution context to execute concurrent processes using futures. Number of threads is defined in a fixed thread pool. Blocking for a maximum number of minutes, see http://docs.scala-lang.org/style/naming-conventions.html for non-blocking alternative.
import java.util.concurrent.Executors
import scala.concurrent.Await
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.concurrent.duration.DurationInt
/**
* Use execution context to execute concurrent processes using futures.
* Number of threads is defined in a fixed thread pool.
* Blocking for a maximum number of minutes, see http://docs.scala-lang.org/style/naming-conventions.html
@shsdev
shsdev / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@shsdev
shsdev / CsvCreator.java
Created April 29, 2014 07:20
Using jackson-dataformat-csv to create CSV file out of POJOs
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.dataformat.csv.CsvMapper;
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;