Skip to content

Instantly share code, notes, and snippets.

View panchicore's full-sized avatar
👽

Luis Pallares panchicore

👽
View GitHub Profile
"""
The main 'geoname' table has the following fields :
---------------------------------------------------
geonameid : integer id of record in geonames database
name : name of geographical point (utf8) varchar(200)
asciiname : name of geographical point in plain ascii characters, varchar(200)
alternatenames : alternatenames, comma separated, ascii names automatically transliterated, convenience attribute from alternatename table, varchar(10000)
latitude : latitude in decimal degrees (wgs84)
longitude : longitude in decimal degrees (wgs84)
feature class : see http://www.geonames.org/export/codes.html, char(1)
@panchicore
panchicore / mappings.py
Last active July 28, 2017 11:28
get "[WFP] Geonames countries ID mappings" directly from python requests
import requests
# source: https://docs.google.com/spreadsheets/d/18YIk3aQYdx1kIWzLAyUpTshl72P8_uFDGI_8TI2bd1k/edit#gid=0
url = "https://spreadsheets.google.com/feeds/list/18YIk3aQYdx1kIWzLAyUpTshl72P8_uFDGI_8TI2bd1k/od6/public/values?alt=json"
res = requests.get(url)
res = res.json()
for row in res['feed']['entry']:
geonames_name = row['gsx$country']['$t']
geonames_id = row['gsx$geonameid']['$t']
geonames_id = row['gsx$geonameid']['$t']
@panchicore
panchicore / examples.md
Created July 18, 2017 07:23
Scripted fields

My Scripted Fields with Kibana

Dates

Get the year

doc['incident_date'].date.year

Calculating difference in days between 2 dates

(doc['report_date'].date.getMillis() - doc['incident_date'].date.getMillis()) / 1000 / 60 / 60 / 24

@panchicore
panchicore / un.json
Created May 3, 2017 10:30
UN United Nations Organizations List JSON
[
{
"ParentAgencyId": 0,
"UpdateUser": 0,
"AgencyId": 148,
"AgencyTypes": [],
"UpdateDate": "2000-01-01T00:00:00",
"AccountType": 1,
"LongName": "African Technical Assistance Centre",
"Active": true,
@panchicore
panchicore / gist:2f122cf33e54a884d02c155edb250b68
Created March 21, 2017 13:47
aws s3cmd sync elb logs in disk and goaccess them
s3cmd sync s3://aqhj-webaccess2/AWSLogs/290696998068/elasticloadbalancing/us-east-1/2017/03/22/ /logs/elb/AWSLogs/290696998068/elasticloadbalancing/us-east-1/2017/03/22/
find /logs/elb/AWSLogs/290696998068/elasticloadbalancing/us-east-1/2017/ -exec cat {} \;| goaccess --http-protocol=no -a
-q --no-query-string
https://goaccess.io/man#name
@panchicore
panchicore / gist:1ee7042610de49685b1a5a8fd142a933
Created March 21, 2017 13:24
aws s3cmd sync elb logs in disk
s3cmd sync s3://aqhj-webaccess2/AWSLogs/290696998068/elasticloadbalancing/us-east-1/2017/03/22/ /logs/elb/AWSLogs/290696998068/elasticloadbalancing/us-east-1/2017/03/22/
find /logs/elb/AWSLogs/290696998068/elasticloadbalancing/us-east-1/2017/ -exec cat {} \;| goaccess --http-protocol=no
@panchicore
panchicore / query.js
Last active March 13, 2017 08:47
reset parse-server installation badge counter directly from mongodb query
col = db.getCollection("_Installation")
col.update(
{badge: {$gt:0}},
{$set: {badge:0}},
{multi:true}
)
@panchicore
panchicore / italian-verbs.csv
Created February 18, 2017 09:53
Most important Italian verbs database
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
essere
avere
andare
fare
potere
volere
venire
dovere
dare
stare
Worker information
hostname: i-0515722-precise-production-2-worker-org-docker.travisci.net:e7ced2aa-7e22-46a5-a0e5-854e13bdc252
version: v2.5.0-8-g19ea9c2 https://github.com/travis-ci/worker/tree/19ea9c20425c78100500c7cc935892b47024922c
instance: 07f5ea8:travis:python
startup: 775.970325ms
system_info
Build system information
Build language: python
Build group: stable
Build dist: precise
import datetime
import requests
# Create boxes from map here:
# http://boundingbox.klokantech.com/
# FORMAT CSV COMES: ymin, xmin, ymax, xmax
PLACES = {
"FRANCE": [
[0.8129882813,45.5563717359,3.9331054688,47.6616878033],