Skip to content

Instantly share code, notes, and snippets.

View matiskay's full-sized avatar

Edgar Marca matiskay

View GitHub Profile
#!/bin/bash
# config
IMGS=(
"
+ o + + o \n\
+ o o + + \n\
+ o + o + \n\
o + 0 \n\
o + + + + \n\
javascript:( function() {
console.group( 'Performance Information for all entries of ' + window.location.href );
console.log( '\n-> Duration is displayed in ms\n ' )
var entries = window.performance.getEntries();
entries = entries.sort( function( a, b ) {
return b.duration - a.duration;
} );
library('testthat');
test_that('The Standard Desviation of n numbers', {
x <- c(1, 2, 3, 4, 5, 6, 7, 8);
sd <- sd(x);
expect_that(sd, equals(2.449490))
});
@matiskay
matiskay / svm.py
Created August 28, 2014 03:12 — forked from mblondel/svm.py
# Mathieu Blondel, September 2010
# License: BSD 3 clause
import numpy as np
from numpy import linalg
import cvxopt
import cvxopt.solvers
def linear_kernel(x1, x2):
return np.dot(x1, x2)
@matiskay
matiskay / svmflag.py
Created August 28, 2014 03:15 — forked from glamp/svmflag.py
import numpy as np
import pylab as pl
import pandas as pd
from sklearn import svm
from sklearn import linear_model
from sklearn import tree
from sklearn.metrics import confusion_matrix
@matiskay
matiskay / pizza.py
Created September 6, 2014 23:23
Get Pizza information
import requests
import json
pizza_list = 'http://pizzahut.com.pe/Content/static/jsons/pizza-list.json'
#size_list = 'http://pizzahut.com.pe/Content/static/jsons/size-list.json'
r = requests.get(pizza_list)
pizzas = json.loads(r.text)
import json
import geojson
from shapely.geometry import shape
o = {
"coordinates": [[[23.314208, 37.768469], [24.039306, 37.768469], [24.039306, 38.214372], [23.314208, 38.214372], [23.314208, 37.768469]]],
"type": "Polygon"
}
s = json.dumps(o)
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 1.
Fecha Local Hora Local Latitud Longitud Profundidad Magnitud "Intensidad - Localidades"
05/10/2014 06:05:29 -11.95 -77.59 36 Km 4.0 ML II Ancón, Lima
02/10/2014 16:33:57 -12.04 -77.13 60 Km 4.0 ML II-III Lima
01/10/2014 18:47:54 -13.69 -76.47 41 Km 4.6 ML III Pisco; II-III Tambo de Mora, Chincha Alta;II San Vicente, Lunahuana, Ica
30/09/2014 06:39:22 -13.84 -71.83 8 Km 3.6 ML II Misca
27/09/2014 21:35:27 -13.81 -71.89 6 Km 5.1 ML VII Misca;VI Cusibamba, Toroy, Moyoc; V Colcha,Rondocán;IV Paccaritambo, Ccochirihuay;III-IV Yaurisque, Huanoquite;III Cusco, Omacha; II-III Ccapi;II Urubamba, Calca, Anta, Yanaoca, Huancarani
25/09/2014 22:54:12 -16.79 -70.60 8 Km 3.8 ML II Calacoa
25/09/2014 06:19:10 -12.49 -77.31 24 Km 3.9 ML II Callao, Lima
19/09/2014 21:44:36 -15.65 -74.03 66 Km 4.5 ML II-III Chala; II Atico, Yauca, Caraveli
17/09/2014 23:19:58 -6.15 -76.35 123 Km 4.9 ML II Lamas, Moyobamba
@matiskay
matiskay / output-mbutil.txt
Last active August 29, 2015 14:07
Using DataMaps.
ops@osm-db:~/learning$ mb-util tiles/planet planet.mbtiles
INFO:mbutil.util:Importing disk to MBTiles
DEBUG:mbutil.util:tiles/planet --> planet.mbtiles
INFO:mbutil.util:metadata from metadata.json restored
DEBUG:mbutil.util: Read tile from Zoom (z): 0 Col (x): 0 Row (y): 0
DEBUG:mbutil.util: Read tile from Zoom (z): 2 Col (x): 1 Row (y): 2
DEBUG:mbutil.util: Read tile from Zoom (z): 1 Col (x): 0 Row (y): 1
DEBUG:mbutil.util: Read tile from Zoom (z): 8 Col (x): 75 Row (y): 159
DEBUG:mbutil.util: Read tile from Zoom (z): 5 Col (x): 9 Row (y): 19
DEBUG:mbutil.util: Read tile from Zoom (z): 6 Col (x): 18 Row (y): 39
@matiskay
matiskay / README.mkd
Last active August 29, 2015 14:07
All the independent country in LATAM

Latam in OpenStreetMaps

Rendering all the points in Latam

Points

Rendering all the lines in Latam

Lines