Skip to content

Instantly share code, notes, and snippets.

@arthuralvim
arthuralvim / awscli.md
Last active October 30, 2018 19:03 — forked from victorfsf/awscli.md
Downloading and uploading from/to a S3 Bucket using AWS CLI

Installing & Configuring

$ sudo pip install awscli (or: sudo apt-get install awscli)
$ aws configure

You'll need to fill the following settings:

@arthuralvim
arthuralvim / remove_mongo_ids.js
Created July 27, 2017 17:56
Remove mongo ids from specific collection.
var mongo_ids = [
ObjectId("596cc5e54060d2999dd2ffb2"),
...
];
db.getCollection('collection_name').remove({
_id: {
$nin: mongo_ids
}
})
@arthuralvim
arthuralvim / jekyll-and-liquid.md
Created August 29, 2017 20:53 — forked from magicznyleszek/jekyll-and-liquid.md
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes:

@arthuralvim
arthuralvim / GeoIP.dat
Created September 13, 2017 20:30
ETL vs ELT
This file has been truncated, but you can view the full file.
0100 0002 0000 0300 0004 0000 5fa0 0060
a000 0500 0006 0000 4e34 004f 3400 0700
0008 0000 aa10 00ab 1000 0900 000a 0000
9e09 009f 0900 0b00 000c 0000 5a07 005b
0700 0d00 000e 0000 3301 00e1 ffff 00ff
ff0f 0000 6900 006a 0000 1000 0011 0000
1200 0013 0000 5a00 005b 0000 1400 0015
0000 5400 0055 0000 1600 0017 0000 4a00
004b 0000 1800 0019 0000 4700 0030 ffff
1a00 001b 0000 3d00 0030 ffff 1c00 001d
@arthuralvim
arthuralvim / collection_size.py
Created October 4, 2017 14:44 — forked from luizbraga/collection_size.py
List collections, size and count of documents on MongoDB
from pymongo import MongoClient
MONGO_URI = ''
DATABASE_NAME = ''
client = MongoClient(MONGO_URI)
db = client[DATABASE_NAME]
collections = db.collection_names()
def readable_size(file_size):
@arthuralvim
arthuralvim / pep20_by_example.py
Created October 19, 2017 19:11 — forked from evandrix/pep20_by_example.py
PEP 20 (The Zen of Python) by example
#!/usr/bin/env python
"""
=====================================
PEP 20 (The Zen of Python) by example
=====================================
Usage: %prog
:Author: Hunter Blanks, hblanks@artifex.org / hblanks@monetate.com
@arthuralvim
arthuralvim / NLTK and Named Entity Recognition (Person).ipynb
Created October 19, 2017 19:11
LTK and Named Entity Recognition (Person) in Brazilian Portuguese
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@arthuralvim
arthuralvim / mongodb_snippets.md
Last active November 21, 2017 13:44
MongoDB Snippets

basic search

db.getCollection('collection_1').find({});

projection

db.getCollection('collection_1').find({}, {'_id': 1});
@arthuralvim
arthuralvim / jsonschema_example.py
Created November 21, 2017 13:42
Testing jsonschema.
# pip install jsonschema
import json
from jsonschema import Draft4Validator
lista_exemplo = [
{'attr1': 'A', 'attr2': 2, 'attr3': 3, 'attr4': 4},
{'attr1': 1, 'attr2': 2, 'attr3': 3, 'attr4': 4, 'attr5': 5},
{'attr1': 1, 'attr2': 2, 'attr3': 3, 'attr4': 4},
{'attr1': 1, 'attr2': 2, 'attr3': 3, 'attr4': 4},