Skip to content

Instantly share code, notes, and snippets.

Michele Orsi micheleorsi

Block or report user

Report or block micheleorsi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@micheleorsi
micheleorsi / Dockerfile
Created Feb 26, 2017
Automation in Google Cloud for Kubernetes cluster: terraform + kargo
View Dockerfile
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 Oct 10, 2016
Machine Learning with Python for Algorithmic Trading
View stock_trading_example.py
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 / README.md
Last active Aug 30, 2015
Topojson reference
View README.md
ogr2ogr -f "GeoJSON" california_geojson.json tl_2010_06_zcta510.shp
topojson -o california_topojson.json california_geojson.json

convert counties and zipcode shapefiles to GeoJson

ogr2ogr -f "GeoJSON" working/counties.geo.json assets/ca/counties.shp
ogr2ogr -f "GeoJSON" working/zipcodes.geo.json source/tl_2010_06_zcta510.shp

# merge two shapefils
@micheleorsi
micheleorsi / Prepare raspberry for usage with docker.md
Last active Sep 18, 2016
Running docker on ARM processor (tested on Raspberry Pi 2 Model B)
View Prepare raspberry for usage with docker.md

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>
View gist:801e68a73ceb6cd0d4ef
public boolean solution(int[] A) {
if(isArrayInNonDecreasingOrder(A)) {
return true;
}
for(int i=0; i<A.length; i++) {
for(int j=0; j < A.length; j++) {
if(i!=j) {
int[] testArray = A.clone();
int tempValue = testArray[i];
testArray[i]=testArray[j];
@micheleorsi
micheleorsi / docker
Last active Sep 29, 2015
Quick reference for personal needs
View docker
# Remove all stopped containers.
docker rm $(docker ps -a -q)
# Remove all untagged images
docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
View _etc_samba_smb.conf
[global]
workgroup = WORKGROUP
server string = %h server
wins support = yes
@micheleorsi
micheleorsi / _etc_logstash_conf.d_central.conf
Created Jan 22, 2015
Logstash configuration with Google App Engine logs
View _etc_logstash_conf.d_central.conf
input {
file {
type => "gae"
path => ["/home/ubuntu/gae_logs/**/*log"]
tags => ["some","tags"]
stat_interval => 30
discover_interval => 180
}
}
@micheleorsi
micheleorsi / crontab
Last active Aug 29, 2015
Download logs from Google App Engine with appcfg tool
View crontab
# REQUEST NORMAL LOGS
# once a day at 23:50
50 23 * * * <full-path>/appcfg.py -A <gae-application-name> -M <module-name> -V <version-name> --oauth2 --include_all --append -n 1 request_logs <full-path>/`date +\%y-\%m-\%d`.log
# REQUEST LOGS WITH WARNING AND SEVERE INFOS
# once a day at 23:50
50 23 * * * <full-path>/appcfg.py -A <gae-application-name> -M <module-name> -V <version-name> --oauth2 --include_all --append -n 1 --severity=2 request_logs <full-path>/`date +\%y-\%m-\%d`-full.log
@micheleorsi
micheleorsi / nginx.conf
Created Jan 22, 2015
configuration file to proxy and cache requests from a backend
View nginx.conf
worker_processes 4;
events {
worker_connections 1024;
}
http {
##
# Basic Settings
You can’t perform that action at this time.