This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !pip install watermark | |
%load_ext watermark | |
%watermark -udtz -v -m -iv -rg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from io import TextIOWrapper, BytesIO | |
from gzip import GzipFile | |
import csv | |
import logging | |
import collections | |
from tqdm import tqdm_notebook as tqdm | |
logging.basicConfig(level=logging.INFO) | |
logger = logging.getLogger(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
from argparse import ArgumentParser | |
import boto3 | |
import pandas as pd | |
CSV_FILENAME = 'ec2_reserves.csv' | |
ec2 = boto3.client('ec2') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import urllib3 | |
url_delete = 'http://172.31.x.x:9200/my_index/_delete_by_query' | |
query_delete = { | |
"query": { "match": { "fk_xxx": day }} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch -n 2 'ip address' | |
# Du para diretórios | |
https://dev.yorhel.nl/ncdu | |
Freeing disk space on your Linux server | |
- Get to the root of your machine by running cd / | |
- Run sudo du -h --max-depth=1. | |
- Note which directories are using a lot of disk space. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import argparse | |
import elasticsearch | |
from io import TextIOWrapper | |
from gzip import GzipFile | |
import csv | |
fact_key = "/2018/05/15/mycsv_files" | |
BUCKET = 'csv_data' | |
print(f'Reading files at {fact_key}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
{USAGE} | |
python thisfile.py param1 | |
""" | |
import sys | |
import os | |
import pprint as pp | |
import argparse | |
import logging | |
import traceback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Combinações e contrações do português | |
https://pt.wiktionary.org/wiki/Ap%C3%AAndice:Adv%C3%A9rbios_do_portugu%C3%AAs | |
https://pt.wiktionary.org/wiki/Ap%C3%AAndice:Gent%C3%ADlicos_e_top%C3%B3nimos_em_portugu%C3%AAs | |
CONTRACOES = [ | |
# Com a preposição "com" + Artigos definidos | |
(('com','um'),'cum'), | |
# A preposição "de" + Artigos definidos | |
(('de','o'),'do'), | |
(('de','a'),'da'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from io import BytesIO | |
from zipfile import ZipFile | |
# Download the dataset | |
dk = requests.get('http://www.ssfpack.com/files/DK-data.zip').content | |
f = BytesIO(dk) | |
zipped = ZipFile(f) | |
df = pd.read_table( | |
BytesIO(zipped.read('internet.dat')), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import re | |
EMAIL_REGEXP = '^[_A-Za-z0-9-+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,3})$' | |
#from tqdm import tqdm_notebook as tqdm | |
import gensim | |
import collections | |
import nltk |