Instantly share code, notes, and snippets.

🐢
Thinking slowly

# Riccardo Scalco riccardoscalco

🐢
Thinking slowly
Last active July 22, 2022 16:32
Confidence intervals on linear regression

## Confidence intervals on linear regression

Python code for the evaluation of linear regression and confidence intervals between two random variables x and y.

Last active April 1, 2020 14:02
Topojson of Italy (province)
Last active January 11, 2022 16:20

## Twitter users visibility by means of regular Markov chains.

This is an attempt to define user visibility on a specific topic. Briefly, tweets are collected via the Twitter streaming API, stored in sqlite databases and then processed in order to create a regular Markov chain. The steady state distribution of the chain defines a metric on the set of Twitter users, which can be used to retrieve an ordered list of users.

Have a look at this paper and this other paper for further details about the mathematical methods.

Be careful, the procedure described here is experimental and it is not meant to be used in production environments.

#### Fetching and storing from the Twitter streaming

Last active August 29, 2015 14:09
git commands

## git commands

```git init #inizializza un repository

git add -A ./ #aggiunge tutti i files alla area di stage, e tiene conto delle cancellazioni
git rm 'file.txt' #rimuove il file e fa lo stage della rimozione
git rm -r ./folder
git reset file.name #rimuove un file dalla area di stage```
Last active August 29, 2015 14:09
Mean life time

## Mean life time

Let say you have a process that decays exponentially, with constant `lamb`

```>>> t = [..] #list of times
>>> x = [x0 * math.exp(-t[i]/lamb) for i in range(n)]```

Constant `lamb` can be derived from vector `x`

Last active August 29, 2015 14:10
Time axis changing in real time

## Time axis changing in real time

Created April 27, 2015 09:30
Drop Collection with Pymongo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 import pymongo from pymongo import MongoClient # Removes a collection from the database. # http://docs.mongodb.org/manual/reference/method/db.collection.drop/ client = MongoClient() db = client.dbname db.drop_collection('collectionName')
Created April 27, 2015 12:37
Python code beautifier
Created April 28, 2015 10:08
￼Locally test npm modules
```\$ cd /my/module/path
\$ npm pack
\$ cd /my/project/path
\$ npm install /my/modue/path/packagename-version.tgz```
Last active August 29, 2015 14:20
AI+D3

# AI + D3 = BOOMM

Adobe Illustrator (AI) e la libreria JavaScript D3.js sono strumenti utilizzati universalmente nell'ambito dell'Information Design e Data Visualization.

Il corso trae spunto dalla difficoltà pratica da un lato di creare infografiche complesse con il solo uso di D3, dall'altro di introdurre transizioni dinamiche e data driven all'interno di infografiche create con AI.

Lo studente affronterà un percorso a step in cui l'uso di Adobe Illustrator e la manipolazione di codice Javascript D3 si susseguiranno più volte, al fine di ottenere un prodotto che sia frutto dell'unione dei due strumenti.

Il corso è rivolto a disegnatori grafici e programmatori frontend i quali desiderano: