Skip to content

Instantly share code, notes, and snippets.

@joaospinto
joaospinto / sums_and_products.py
Created August 2, 2019 13:10
Solves a problem about guessing numbers from sums and products
products = dict()
for i in range(2, 101):
for j in range(i, 101):
products[i * j] = products.get(i * j, []) + [(i, j)]
ambiguous_products = set()
for product in products:
if len(products[product]) > 1:
ambiguous_products.add(product)
possible_sums = []
for s in range(4, 201):
@joaospinto
joaospinto / tmux.conf
Created January 10, 2018 20:17
tmux configuration
set-option -sg escape-time 10
set-option -g default-terminal "screen-256color"
@joaospinto
joaospinto / init.vim
Last active January 24, 2018 17:29
neovim configuration
call plug#begin()
" LSP for neovim
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" Multi-entry selection UI.
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
@joaospinto
joaospinto / google_drive.py
Created November 4, 2017 23:28
Download Google Drive public file from command line (October 2017)
# Credits: https://stackoverflow.com/questions/25010369/wget-curl-large-file-from-google-drive
import requests
def download_file_from_google_drive(id, destination):
def get_confirm_token(response):
for key, value in response.cookies.items():
if key.startswith('download_warning'):
return value
@joaospinto
joaospinto / keybase.md
Created April 4, 2017 09:41
keybase.io

Keybase proof

I hereby claim:

  • I am joaospinto on github.
  • I am joaospinto (https://keybase.io/joaospinto) on keybase.
  • I have a public key whose fingerprint is A405 5D8F 2426 501A 5E94 E5E5 E53A DED2 C9F1 C85D

To claim this, I am signing this object: