Skip to content

Instantly share code, notes, and snippets.

View fredericojordan's full-sized avatar

Frederico Jordan fredericojordan

  • Florianópolis, Brazil
View GitHub Profile
@fredericojordan
fredericojordan / microwave.py
Created July 21, 2023 18:09
Microwave Times
def time(digits):
seconds = int(digits[-2:])
minutes = int(digits[:-2]) if len(digits) > 2 else 0
minutes += seconds // 60
seconds = seconds % 60
result = f"{minutes}:{seconds:02}"
print(result)
return result
time("11") # 11
@fredericojordan
fredericojordan / copa.zap
Last active December 19, 2022 13:46
Resumo da Copa
⚽ *RESUMO DA COPA* 🏆
Grupo A:
Qatar 0 x 2 Equador
*Senegal* 0 x 2 *Holanda*
Qatar 1 x 3 *Senegal*
*Holanda* 1 x 1 Equador
Equador 1 x 2 *Senegal*
*Holanda* 2 x 0 Qatar
@fredericojordan
fredericojordan / awesome-requirements.md
Last active July 3, 2020 14:31
A (not-so-well) curated list of awesome Python libraries

Analysis

  • Bandit Bandit is a tool designed to find common security issues in Python code.
  • Black The uncompromising Python code formatter
  • sentry-python The new Python SDK for Sentry.io

Artificial Intelligence

  • Tensorflow An Open Source Machine Learning Framework for Everyone

Concurrency

  • Celery Distributed Task Queue (development branch)
@fredericojordan
fredericojordan / sir_model.py
Created April 10, 2020 19:04
Graphing the "Coronavirus curve" with Python
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import odeint
MAX_TIME = 20.0
infected_start = 0.01
infection_rate = 2.5
recovery_rate = 0.3
@fredericojordan
fredericojordan / fly-straight-dammit.py
Last active February 20, 2020 17:03
Python implementation of the A133058 sequence of integers https://oeis.org/A133058
"""
Python implementation of the A133058 sequence of integers
https://oeis.org/A133058
"""
import functools
_PLOT = False
try:
import matplotlib.pyplot as plt
@fredericojordan
fredericojordan / javascript-sucks.js
Created January 22, 2020 19:06
Comprehensive list of reasons why Javascript is a lousy language
// DISCLAIMER: This file is for informational and humorous purposes.
// There's no such thing as a perfect language!
// Understanding the limitations of your tools is essencial to be a good programmer.
console.log(`1e16: ${1e16}`)
console.log(`1e16+1: ${1e16 + 1}`)
console.log()
console.log(`0.1 + 0.2: ${0.1 + 0.2}`)
console.log(`0.1 + 0.2 == 0.3: ${0.1 + 0.2 == 0.3}`)
def lazyfy(word):
if len(word) < 4:
return word
return f"{word[0]}{len(word)-2}{word[-1]}"
# MAGIC HACK: without this, a recent Homebrew update broke GDAL!
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
@fredericojordan
fredericojordan / heroku_cli_loader.py
Created June 14, 2019 14:58
Heroku's CLI loader implemented in Python
# !/usr/bin/python
# -*- coding: utf-8 -*-
import time
STEPS = [
"⡿",
"⣟",
"⣯",
"⣷",
"⣾",