Skip to content

Instantly share code, notes, and snippets.

View barraponto's full-sized avatar

Capi Etheriel barraponto

View GitHub Profile
const convertCurrency = (from, to, amount) => {
const countries = getCountries(to);
const rate = getExchangeRate(from, to);
return Promise.all([countries, rate])
.then(([countries, rate]) => {
const exchangedAmount = amount * rate
return `${amount} ${from} is worth ${exchangedAmount} ${to}. ${to} can be used in the following countries: ${countries.join(', ')}`
})
}
@barraponto
barraponto / mkp2pblocklist
Created September 4, 2017 16:23 — forked from glaszig/mkp2pblocklist
creates a blocklist for your p2p endeavors
#!/usr/bin/env sh
# inspired by https://gist.github.com/johntyree/3331662#gistcomment-1968023
#
# usage:
# mkp2pblocklist > /tmp/blockp2p.list
# or
# mkp2pblocklist | gzip -9 > /tmp/blockp2p.list.gz
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH"
@barraponto
barraponto / gh-pages-deploy.md
Created October 20, 2016 18:19 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

import random
from flatlib.datetime import Datetime
from flatlib.geopos import GeoPos
from flatlib.chart import Chart
from flatlib import const
planets = {
'sun' : ['self-expression', 'will', 'assertion'],
'moon' : ['response', 'intuition', 'feeling'],
@barraponto
barraponto / Copa2014.py
Last active May 20, 2016 02:32 — forked from fmasanori/Copa2014.py
Pythonic sum of 2014 World Cup spendings
# coding: utf-8
from urllib.request import urlopen
from xml.etree import ElementTree
class Budget(object):
'''2014 World Cup budget parser.'''
def __init__(self, data_url):
'''Parses XML from data_url.'''
@barraponto
barraponto / gist:7140704
Last active December 26, 2015 10:59 — forked from pmarkun/gist:7138789
from time import sleep
from os import linesep as delimiter
from twisted.internet import stdio
from twisted.protocols import basic
from twisted.internet import reactor
class WakeUpCall(basic.LineReceiver):
def connectionMade(self):
import sys
number_of_args = len(sys.argv)
def get_int():
""" Function used to test user input as a valid integer.
If input is not a valid integer ask the user to try again"""
integer = ""
switch = False
while switch == False:
@barraponto
barraponto / pyquery-spider.py
Created September 30, 2012 18:29
The is a re-implementation of the Scrapy spider tutorial using HtmlCSSSelector
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlCSSSelector
class DmozSpiderCSS(BaseSpider):
name = "pyquery"
allowed_domains = ["dmoz.org"]
start_urls = [
"http://www.dmoz.org/Computers/Programming/Languages/Python/Books/",
"http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/"
]
@barraponto
barraponto / hackdayjson
Created September 16, 2012 19:11 — forked from anonymous/hackdayjson
HackDay JSON Sample
{
"nome":"FRANCISCO EVERALDO OLIVEIRA SILVA",
"ocupacao":"ATOR E DIRETOR DE ESPETÁCULOS PÚBLICOS",
"nascimento_data":"01-MAY-65",
"nascimento_municipio":"ITAPIPOCA",
"instrucao":"LÊ E ESCREVE",
"numero":"2222",
"nome_urna":"TIRIRICA",
"ano":"2012",
"uf":"SP",
__author__ = 'Jonathan'
import random
questions = {
"strong": "Do ye like yer drinks strong?",
"salty": "Do ye like it with a salty tang?",
"bitter": "Are ye a lubber who likes it bitter?",
"sweet": "Would ye like a bit of sweetness with yer poison?",
"fruity": "Are ye one for a fruity finish?"