Skip to content

Instantly share code, notes, and snippets.

View maurobaraldi's full-sized avatar

Mauro Navarro Baraldi maurobaraldi

View GitHub Profile
@maurobaraldi
maurobaraldi / bovespa_intraday.py
Last active March 28, 2024 09:41
Cotações da Bovespa Intraday
#!/usr/bin/env python
from datetime import datetime
from json import loads
from time import gmtime, mktime, strptime
# LevelDict é um wrapper usando dicionário para LevelDB
# https://github.com/maurobaraldi/leveldict
from leveldict import LevelJsonDict
from requests import get
@maurobaraldi
maurobaraldi / dolar.py
Created March 2, 2020 18:58
Cotação do Dolar Comercial e Euro via API do UOL economia.
#!/usr/bin/env python3
from datetime import datetime
from json import loads
from urllib.request import urlopen
request = urlopen('https://api.cotacoes.uol.com/currency/intraday/list?currency=1&fields=bidvalue,date').read()
price = loads(request)['docs'][0]
price['date'] = datetime.strptime(price['date'], '%Y%m%d%H%M%S').strftime('%d/%m/%Y às %H:%M:%S')
if __name__ == '__main__':
@maurobaraldi
maurobaraldi / server.py
Last active February 14, 2024 18:57
Tests BaseHTTPRequestHandler
#!/usr/bin/env python
from http.server import HTTPServer, BaseHTTPRequestHandler
class HTTPRequestHandler(BaseHTTPRequestHandler):
protocol_version = "HTTP/1.0"
def do_GET(self):
self.send_response(200)
@maurobaraldi
maurobaraldi / TradingBotOanda.ipynb
Created November 20, 2023 19:47
Trading bot for Oanda platform
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maurobaraldi
maurobaraldi / tests.py
Created May 24, 2016 17:53
Django unittest view with mock
from django.test import Client, TestCase
from mock import patch
from .views import index
class SimpleTestCase(TestCase):
def setUp(self):
self.client = Client()
@patch('api.views.requests')
@maurobaraldi
maurobaraldi / uniswap_pools_analyser.js
Created April 30, 2023 21:58
Uniswap Pools Analyser for Enthereum network.
//
// Uniswap Pools Analyser
// Author: Mauro Navarro Baraldi <mauro.baraldi@gmail.com>
// License: MIT License
//
// If you consider pay me a coffee here are the wallets
// {
// "bitcoin": "1EUGcJHS49242UpDXNVoLVzWSTVPRKmRth",
// "litecoin": "LbqRSz5i225FqED4QTFwjU5qQS72cRdvoe",
// "ethereum": "0xfA5c619f46848Fefe1E35Da1A04d4cBCeaf16B1f"
@maurobaraldi
maurobaraldi / key.md
Created February 6, 2023 14:34
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA

@maurobaraldi
maurobaraldi / gen_btc_wallet.py
Last active December 28, 2022 16:42
Generate Bitcoin Wallets in Python 3
#!/usr/bin/env python3
import binascii
import hashlib
import pip
# Install base58 and ecdsa libs if not installed yeat.
try:
import base58
import ecdsa
@maurobaraldi
maurobaraldi / advent_of_code_2022.py
Last active December 5, 2022 22:03
Advent of Code 2022
#!/usr/bin/env python
# Solutions for Advent of Code 2022
# Problem 1.1
with open('./input.txt') as f:
elves_kal = [list(map(int, i.split())) for i in f.read().split('\n\n')]
print(max(sum(k) for k in elves_kal))
# Problem 1.2
@maurobaraldi
maurobaraldi / vocabulos_ptbr
Created December 7, 2014 01:11
lista de vocabulos pt-br
This file has been truncated, but you can view the full file.
a
a
a
a
a
a
a
a
a
A