Skip to content

Instantly share code, notes, and snippets.

javi santana javisantana

Block or report user

Report or block javisantana

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
@javisantana
javisantana / res.sql
Last active Jun 20, 2019
filter ourside the join vs inside the join in clickhouse
View res.sql
MacBook-Pro-de-javi.local :) select cityHash64(groupArray(cityHash64(*))) from A a asof inner join (select * from B where ts<toDateTime('1970-01-01 02:00:00')) b on a.id=b.id and a.ts=b.ts where a.ts<toDateTime('1970-01-01 02:00:00');
SELECT cityHash64(groupArray(cityHash64(*)))
FROM A AS a
ASOF INNER JOIN
(
SELECT *
FROM B
WHERE ts < toDateTime('1970-01-01 02:00:00')
) AS b ON (a.id = b.id) AND (a.ts = b.ts)
View charla
https://docs.google.com/presentation/d/1vURI9yYJvAm0couPbFeKz09sr8bvQuSzCfcTEBow7ec/edit#slide=id.g5294e95553_0_101
@javisantana
javisantana / clickhouse_osx.md
Last active May 21, 2019
how to build clickhouse on osx high sierra
View clickhouse_osx.md

IMPORTANT, this worked with CH stable (76629e9) version on 2019/02/14

install requirements

from the original osx build doc page https://clickhouse.yandex/docs/en/development/build_osx.html

build clickhouse

Add /usr/local/include to the default path for gcc (for some reason gcc-7 was not using that folder on osx)

@javisantana
javisantana / mercator_numpy.py
Created Jan 20, 2018
mercator projection using numpy
View mercator_numpy.py
"""
projects a numpy array with (lon, lat) to (x, y) in mercator coordinates using numpy
license: MIT
adapted from https://github.com/mapbox/mercantile
"""
import numpy as np
import math
View haversine_numpy.py
"""haversine function adapted to work with numpy arrays
Adapted from https://github.com/mapado/haversine/blob/master/haversine/__init__.py
License: MIT
"""
import math
import numpy as np
AVG_EARTH_RADIUS = 6371 * 1000 # m
View .vimrc
set nocompatible
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
let g:ackprg = 'ag --nogroup --nocolor --column'
map <F6> :%s/>\s*</>\r</g<CR>ggVG=
"colorscheme koehler
View mercator.js
// license: BSD3
const WEBMERCATOR_R = 6378137.0;
const DIAMETER = WEBMERCATOR_R * 2 * Math.PI;
class Mercator {
static project(lon, lat) {
var x = DIAMETER * lon/360.0;
var sinlat = Math.sin(lat * Math.PI/180.0);
var y = DIAMETER *Math.log((1+sinlat)/(1-sinlat)) / (4*Math.PI);
return { x, y };
}
View carto.py
import urllib,sys,csv;
print reduce(lambda p, new: (p[0] + (new - p[0])/p[1], p[1] + 1), map(float, (x['tip_amount'] for x in csv.DictReader(urllib.urlopen(sys.argv[1])))), (0, 1))
View python_code_test_carto.md

Build the following and make it run as fast as you possibly can using Python 3 (vanilla). The faster it runs, the more you will impress us!

Your code should:

All of that in the most efficient way you can come up with.

@javisantana
javisantana / index.html
Created Jul 27, 2016 — forked from naguher/index.html
Web Máster Economia
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>HOJA DE ESTILO DISEÑO ECONOMIA</title>
<meta name="description" content="Hoja de estilo para diseño del Master Economia">
You can’t perform that action at this time.