Skip to content

Instantly share code, notes, and snippets.

@micheleorsi
micheleorsi / gist:822192bbe0904cca3f7f
Last active August 29, 2015 14:05
Installation Elasticsearch / LogStash on Ubuntu in Amazon AWS
# set public key
# change timezone to PST (sudo dpkg-reconfigure tzdata)
# update VM
$ sudo apt-get update && sudo apt-get upgrade
# install java
$ sudo apt-get -y install openjdk-7-jdk
$ java -version
@micheleorsi
micheleorsi / crontab
Last active August 29, 2015 14:05
Crontab for export Google App Engine logs
# run every 10 minutes
*/10 * * * * $GAE_PATH/appcfg.py -A <application-name> -V <release-name> -M <module> --oauth2 --include_all --append -n 1 request_logs $LOG_PATH`date +\%y-\%m-\%d`-log.log
@micheleorsi
micheleorsi / keybase.md
Created November 7, 2014 16:25
keybase.md

Keybase proof

I hereby claim:

  • I am micheleorsi on github.
  • I am micheleorsi (https://keybase.io/micheleorsi) on keybase.
  • I have a public key whose fingerprint is F846 98A8 2306 114C C604 7478 69AB 77A6 10F6 6B7F

To claim this, I am signing this object:

@micheleorsi
micheleorsi / gist:b3086060e37db3e18bf7
Last active August 29, 2015 14:10
crontab examples
# once a day at 23:50
50 23 * * * <command>
# every 2 hours at 00 minutes
0 */2 * * * <command>
# every hour at 29 and 59 minutes (that means every half an hour)
29,59 * * * * <command>
# every hour at 59 minutes
@micheleorsi
micheleorsi / crontab -e
Last active August 29, 2015 14:11
Make a zip, upload to Google Cloud Storage every couple of days
# every couple of days at 2PM run git repo backup
0 14 */2 * * /home/git/runBackup.sh
@micheleorsi
micheleorsi / nginx.conf
Created January 22, 2015 10:36
configuration file to proxy and cache requests from a backend
worker_processes 4;
events {
worker_connections 1024;
}
http {
##
# Basic Settings
@micheleorsi
micheleorsi / crontab
Last active August 29, 2015 14:13
Download logs from Google App Engine with appcfg tool
# 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
[global]
workgroup = WORKGROUP
server string = %h server
wins support = yes
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 / README.md
Last active August 30, 2015 15:54
Topojson reference
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