Skip to content

Instantly share code, notes, and snippets.

View santiagobasulto's full-sized avatar

Santiago Basulto santiagobasulto

View GitHub Profile
Install exp guide:
$ npm install -g exp
Init an empty exponent app:
$ exp init [PATH]
# This is really bad, please don't do it
class User(object):
pass
mary = User()
mary.email = '[email protected]'
joe = User()
joe.emai = '[email protected]' # Typo 😖

Exercise Nº 1 Using a nested for loop, print the string "hello" 12 times. Use different combinations of numbers. For example, the outer loop would loop 6 times and the inner one 2 times (6*2 = 12). Etc.

Exercise Nº 2 Create a nested for loop to produce the following string:

*
**
***
"""
rmotr.com | Analyze HN 'Who is Hiring'
$ mkvirtualenv -p $(which python3)
$ pip install requests beautifulsoup4
"""
from bs4 import BeautifulSoup
import requests
HN_POST = 'https://news.ycombinator.com/item?id=12202865'
for keyword, posts in post_matches.items():
print("{keyword}: {count} job offers found".format(
keyword=keyword, len(posts))
# Python: 180 job offers found
# Javascript: 100 job offers found
# Disclaimer: Not based in real data
keywords = ['python', 'django', 'remote']
post_matches = {}
for _post in job_posts:
post = _post.lower()
for keyword in keywords:
if keyword.lower() in post:
post_matches.setdefault(keyword, [])
post_matches[keyword].append(_post)
# {
from bs4 import BeautifulSoup
import requests
job_posts = []
page = requests.get(
"https://news.ycombinator.com/item?id=11814828")
soup = BeautifulSoup(page.text, 'html.parser')
posts = soup.find_all("tr", class_="athing")
for post in posts:
if post.find("img", width="0"):

Uber in Argentina. Chronological details

Things are going crazy with Uber landing in Argentina. I thought it'd be cool to have a chronological summary of what's been going on lately.

27.3.2016: Uber officially starts recruiting drivers. Uber launch seems imminent: http://www.infobae.com/2016/03/27/1799470-uber-da-su-primer-paso-el-pais-y-convoca-conductores-buenos-aires

12.4.2016 (10PM): Uber officially launched: http://www.infobae.com/2016/04/12/1803830-confirmado-uber-se-podra-usar-las-1600-buenos-aires

12.4.2016 (6PM): Buenos Aires police seized Uber driver's car. Fined him with ARS$77.000 (aprox US$5.133): http://www.infobae.com/2016/04/14/1804342-la-ciudad-secuestro-el-primer-auto-uber-y-multo-al-conductor-77-mil-pesos

# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind / split-window -h
bind - split-window -v
unbind '"'
unbind %
@santiagobasulto
santiagobasulto / random_iterator.py
Last active August 29, 2015 14:23
Python iterators example: A random number iterator that doesn't repeat elements.
from random import randint
class RandomNumberIterator(object):
def __init__(self, smallest=0, largest=1000):
self.served = set()
self.smallest = smallest
self.largest = largest
def __iter__(self):