Skip to content

Instantly share code, notes, and snippets.

View panchicore's full-sized avatar
👽

Luis Pallares panchicore

👽
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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']
"""
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 / 7days.geojson
Last active September 29, 2017 13:10
TerrorEvents tweet map. Latest update 2017-09-29T15:10:03.208493 [UTC+01:00], Fork it on https://github.com/panchicore/terrorevents-map
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1, Ju3stin T3imb3erlake, Title 545, Price $7.30
2, Tayl4or Sw4ift, Title 723, Price $7.90
3, Mi4ck J3a2gger, Title 610, Price $7.90
4, La3dy Ga243ga, Title 118, Price $7.30
5, Joh234nny C3ash, Title 482, Price $6.50
6, Elvis Presl4ey, Title 335, Price $7.30
7, 444John Lennon4444, Title 271, Price $7.90
8, 444John Lennon4444, Title 271, Price $7.90
9, 444John Lennon4444, Title 271, Price $7.90
10, Ju3stin T3imb3erlake, Title 545, Price $7.30
@panchicore
panchicore / 0.input
Last active September 28, 2017 11:45
AAA000 AAJ999 BOGOTAD.E. BOGOTA D.E. PARTICULAR
AAK000 AAZ999 NARIÑO INUES PARTICULAR
ABA000 ABJ999 BOGOTAD.E. BOGOTA D.E. PARTICULAR
ACA000 ACJ999 BOGOTAD.E. BOGOTA D.E. PARTICULAR
ACK000 ACZ999 NARINO SAMANIEGO PARTICULAR
ADA000 ADJ999 BOGOTAD.E. BOGOTA D.E. PARTICULAR
ADK000 ADK999 ANTIOQUIA ANDES PARTICULAR
AEA000 AEJ999 BOGOTAD.E. BOGOTA D.E. PARTICULAR
AEK000 AEZ999 NARIÑO BUESACO PARTICULAR
AFA000 AFJ999 BOGOTAD.E. BOGOTA D.E. PARTICULAR