Skip to content

Instantly share code, notes, and snippets.

@micheleorsi
micheleorsi / docker
Last active September 29, 2015 15:00
Quick reference for personal needs
# Remove all stopped containers.
docker rm $(docker ps -a -q)
# Remove all untagged images
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
@micheleorsi
micheleorsi / Ogeo specification
Created November 17, 2012 22:48
The specification for hackaton project
From emergency-unit (arduino & sensors)
GET
http://sample-env-kmuwwhu5qf.elasticbeanstalk.com/rest/units/<id-device>?accelerometrox=123&accelerometroy=124&accelerometroz=125
From windows app:
POST
http://sample-env-kmuwwhu5qf.elasticbeanstalk.com/rest/reviews/<type>
POST
http://sample-env-kmuwwhu5qf.elasticbeanstalk.com/rest/hosting/people
@micheleorsi
micheleorsi / 01_Top Channels Query AdSense.sql
Last active December 22, 2015 22:59
"Google Analytics and AdSense Data Analysis in BigQuery" @ Google I/O 2013, https://developers.google.com/events/io/sessions/332940014
SELECT
custom_channel_id,
SUM(earnings) AS earnings
FROM
[google.com:adsense-reports:Reports.DailyCustomChannelReport]
GROUP BY
custom_channel_id
ORDER BY
earnings DESC
LIMIT
@micheleorsi
micheleorsi / LoopCryptoMiner.sh
Last active January 1, 2016 20:09
Mine different crypto currencies, using miningpool.co pool server(s).
#!/bin/bash
# SETTINGS
# You should specify here your worker name
USERNAME="username"
# You should specify here your worker password
PASSWORD="password"
# You should specify here how long each pool should run for
TIMEOUT="6h"
# The path where your miner is located
MINER_PATH="./minerd"
@micheleorsi
micheleorsi / Prepare raspberry for usage with docker.md
Last active September 18, 2016 09:50
Running docker on ARM processor (tested on Raspberry Pi 2 Model B)

Flash image to SD card

This is a list of disk images to flash on SD card in order to natively run docker on your Raspberry: hypriot download page:

From command line:

flash --hostname <host-name> <url-to-download-the-os-from>
@micheleorsi
micheleorsi / .bash_profile
Last active November 4, 2016 21:02
config & reminders for Mac OS X development machine
export JAVA_HOME="$(/usr/libexec/java_home -v 1.7)"
export HOMEBREW_GITHUB_API_TOKEN=<token>
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
export ANDROID_HOME=/usr/local/opt/android-sdk
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
# Amazon AWS
#export AWS_ACCESS_KEY="<key>"
@micheleorsi
micheleorsi / _etc_logstash_conf.d_central.conf
Created January 22, 2015 10:48
Logstash configuration with Google App Engine logs
input {
file {
type => "gae"
path => ["/home/ubuntu/gae_logs/**/*log"]
tags => ["some","tags"]
stat_interval => 30
discover_interval => 180
}
}
@micheleorsi
micheleorsi / Dockerfile
Created February 26, 2017 16:55
Automation in Google Cloud for Kubernetes cluster: terraform + kargo
FROM ubuntu:xenial
MAINTAINER "Michele Orsi <me@micheleorsi.it>"
# ansible
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-add-repository ppa:ansible/ansible
RUN apt-get update
RUN apt-get install -y ansible
@micheleorsi
micheleorsi / stock_trading_example.py
Created October 10, 2016 09:09
Machine Learning with Python for Algorithmic Trading
import numpy as np
import pandas as pd
from pandas_datareader import data as web
from sklearn import linear_model
class ScikitBacktest(object):
def __init__(self,sys):
self.lags = 5
self.symbol = sys
self.get_data()
@micheleorsi
micheleorsi / uploadFile.sh
Created October 30, 2014 15:11
upload file to Google Cloud Storage, set it public and set cache
#!/bin/bash
# Check args
if [ $# \< 2 ]; then
echo "Usage: $(basename $0 $1) <file> <cache-millisec>";
exit 1;
fi
#file name
fileName="";