Skip to content

Instantly share code, notes, and snippets.

View colobas's full-sized avatar

Guilherme Pires colobas

View GitHub Profile
@colobas
colobas / .gitignore
Last active December 21, 2023 16:28
zotero topic modeling
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
import pandas as pd
import requests
from lxml import html, etree
from datetime import datetime as date
from fire import Fire
base_url = 'http://www.euribor-rates.eu/en/euribor-rates-by-year/{}/'
def shorten_label(label):
#cloud-config
autoinstall:
version: 1
early-commands:
- systemctl stop ssh # otherwise packer tries to connect and exceed max attempts
network:
network:
version: 2
ethernets:
eth0:
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
<title>HiPlot</title>
<link href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAB2gAAAaWCAMAAABPsR1DAAACkVBMVEVMaXFCGHdCGHfPaVE5NYDeYWTPoiFCGHdCGHdCGHfkoRMuVoquSmqYYULkZGNCGHdCGHdCGHfOaVJCGHdCGHcA5bZCGHcA5bYA5bYA5bYA5bYA5bYA5bYA5bYA5bYA5bYA5bYA5bZCGHdCGHf/cGAA5bb/cGD/cGD/cGD/cGD/cGD/cGD/cGD/cGBCGHcA5bb/cGD/cGAmcJIA5bbenBb/cGBCGHfLjCL/cGD/cGD/cGDbmRj4sgf0rwnmoxLSkh7sqA3UlB3dmxfppRD0a2H7tQTgnhWsSWrSW2bmZGPdYGTbX2TsZ2L7bmDUXGWscjXLWGbpZmP4bWHgYmTkoRPvqwzZmBnZXmXkY2PvaWLKiyP/uAL/uAL/uALGiCX/uAIUp6MWoaH/uAITqqQVpaLBgyn/uAL/uAL/uAL/uAIWoaERr6XAgym/gSoSraUTq6T/uAL/uAL/uAIXn6ESraXEhifIiiTLjCIUpaLIiiTEhibNjiETqqT/uAISraUVo6IUp6P/uALChSj/uALLjCLGiCXjoBPKZlTOaFLbnRjjY2PgnhWmY0bKiyM/IHktWYv1tgm8nS7eaFrtbVtncWVYInTIqCdgMWUKxqxCGHf/cGAA5bb/uAK9gCsXnaDamRn3sQfmoxLSkh7BgynioBTyrQrFhybqpg/JiiP7tAXVlRwQtKcJyq4D3LMC4LUNvaoTqqQUpqMHzq8OuKgKxqwWoaEE17LvqgzenBfNjiEG07ERr6XJfTXWej/aeUIMwavzc1bmdkzid0nBfy73clr7cV3FfjLrdVDSezzxtgtDooK3s
@colobas
colobas / export-org-list-to-pocket.el
Last active November 10, 2020 06:56
export my to-read list to pocket
(defun parse-entry ()
(let* ((data (org-heading-components))
(link-string (nth 4 data))
(tags-string (nth 5 data))
(link-match (s-match "\\[\\[\\(\\([^\]\:]*\\)\://[^\]]*\\)\\]\\[\\([^\]\:]*\\)\\]\\]" link-string))
(link (nth 1 link-match))
(protocol (nth 2 link-match))
(title (nth 3 link-match))
(dummy (message title))
(tags (if tags-string
@colobas
colobas / .block
Last active September 1, 2020 18:26 — forked from mbostock/.block
testing stuff.
license: gpl-3.0
height: 600
@colobas
colobas / install-all.py
Created July 4, 2019 19:26
script to install/uninstall all python packages in a folder, in editable mode
import os
import subprocess
import sys
import argparse
def install_all():
path = os.path.dirname(os.path.abspath(__file__))
packages = [p for p in next(os.walk(path))[1]
if "setup.py" in os.listdir(p)]
@colobas
colobas / remote_import.py
Created May 24, 2019 00:24
util to import remote modules. can be used with gists, for example.
import tempfile
import requests
from importlib.machinery import SourceFileLoader
def import_remote_module(module_name, url):
"""
import a file from a URL, given by `url`
---
returns the imported module
@colobas
colobas / bins.py
Last active November 23, 2018 17:58
Compute the recommended bin size for a histogram, according to the Freedman-Diaconis rule
def bin_size(x):
"""
https://en.wikipedia.org/wiki/Freedman%E2%80%93Diaconis_rule
"""
return (2 * (np.nanquantile(x, 0.75) - np.nanquantile(x, 0.25)) /
np.cbrt(len(x[~np.isnan(x)])))
from difflib import SequenceMatcher
def longestSubstring(str1,str2):
# initialize SequenceMatcher object with
# input string
seqMatch = SequenceMatcher(None,str1,str2)
# find match of longest sub-string
# output will be like Match(a=0, b=0, size=5)