Skip to content

Instantly share code, notes, and snippets.

View fferegrino's full-sized avatar
📖
Learning

Antonio Feregrino fferegrino

📖
Learning
View GitHub Profile
@fferegrino
fferegrino / i__training_data.csv
Last active November 5, 2018 07:09
Training set for VuelaX
We can't make this file beautiful and searchable because it's too large.
0,44,¡,0,faa,1,FALSE,11,n
0,44,CUN,1,np00000,3,TRUE,11,o
0,44,a,5,sp000,1,FALSE,11,s
0,44,Ámsterdam,7,np00000,9,FALSE,11,d
0,44,$,17,zm,1,FALSE,11,n
0,44,"8,960",18,dn0000,5,FALSE,11,p
0,44,!,23,fat,1,FALSE,11,n
0,44,Sin,25,sp000,3,FALSE,11,n
0,44,escala,29,nc0s000,6,FALSE,11,n
0,44,en,36,sp000,2,FALSE,11,n
@fferegrino
fferegrino / ngrams.py
Created September 28, 2018 06:45
ngrams.py
def ngrams(string, n=3):
# Filter string
ngrams = zip(*[string[i:] for i in range(n)])
return [''.join(ngram) for ngram in ngrams]
@fferegrino
fferegrino / intro-neo4j.adoc
Last active May 25, 2022 07:54
My introduction to neo4j

My introduction to neo4j

Introduction to Neo4j

Let’s create our first basic graph! we’ll create something similar to what you saw in the video (or similar to what you see in this image).

@fferegrino
fferegrino / graph_gist_template.adoc
Created August 10, 2018 08:31 — forked from jexp/graph_gist_template.adoc
CHANGEME: GraphGist Template. Fork to make your own, view source to see instruction comments

REPLACEME: TITLE OF YOUR GRAPHGIST

Introduction

LOAD CSV WITH HEADERS FROM 'file:///flights.csv' as line
MATCH
(a:Airline{ iata: line.AIRLINE }),
(departure:Airport{ iata: line.ORIGIN_AIRPORT }),
(destination:Airport{ iata: line.DESTINATION_AIRPORT })
WITH a, departure, destination, line
LIMIT #limit#
CREATE
(f:Flight{
tail_number: line.TAIL_NUMBER,
@fferegrino
fferegrino / insert.txt
Last active June 18, 2018 19:32
MovieLens database insert
LOAD CSV WITH HEADERS FROM 'file:///movies.clean.csv' as l
CREATE (m:Movie{movieId:toInteger(l.movieId), tmdbId:l.tmdbId, imdbId:l.imdbId, title:l.title, year:date(l.year)})
CREATE INDEX ON :Movie(movieId)
LOAD CSV WITH HEADERS FROM 'file:///users.csv' as l
CREATE (u:User{userId:toInteger(l.userId)})
CREATE INDEX ON :User(userId)
@fferegrino
fferegrino / policy.txt
Created June 15, 2018 08:44
Camera Privacy Policy
This app uses your camera with the sole purpose of delivering its services.
The images captured by the app never leave your phone directly from the app, and they are not stored unless you explicitly authorise them to be saved.
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
,label,url,date
0,"¡Todo México a La Habana – $4,718! Opción de hotel 3 estrellas, 2 personas, 3 noches $3,241 pesos con desayunos",http://www.vuelax.com/2018/03/09/mex-cub/,2018-03-09
1,"¡GDL, CDMX y MTY a San José, Costa Rica – $4,222! Opción de hotel 3 estrellas, 7 noches, 2 personas por $6,389",http://www.vuelax.com/2018/03/09/costa-2/,2018-03-09
2,"¡CDMX, MTY, GDL, TIJ y Silao a Venecia – $13,829!",http://www.vuelax.com/2018/03/09/venecia/,2018-03-09
3,"¡CUN a La Habana – $2,997! Opción de hotel 3 estrellas, 3 noches, 2 personas con desayuno por $2,749",http://www.vuelax.com/2018/03/08/havana-cun/,2018-03-08
4,"¡CDMX, MTY y GDL a Liubliana, Eslovenia – $13,870!",http://www.vuelax.com/2018/03/08/cdmx-mty-y-gdl-a-liubliana-eslovenia-13870/,2018-03-08
5,"¡CDMX a Barcelona + Marrakech – $14,288! Opción de hotel 4 estrellas, 2 personas, 5 noches por $2,610 con desayunos",http://www.vuelax.com/2018/03/08/marrakech-2/,2018-03-08
6,"¡CDMX a Barcelona + Marrakech – $14,288! Opción de hotel 4 estrellas, 2 personas
import re
import pandas as pd
def __parse_time_elapsed__(time_line):
time = float(time_line.split(":")[1][:-len("seconds.")])
return time
def __file_to_lines__(path):
l = None
@fferegrino
fferegrino / read_by_line.py
Last active November 21, 2017 14:02
quick python snips
with open(file, "r") as f:
for line in f:
print(line)