Skip to content

Instantly share code, notes, and snippets.

View luispedro's full-sized avatar

Luis Pedro Coelho luispedro

View GitHub Profile
@luispedro
luispedro / steps2024.py
Last active September 13, 2024 12:46
Steps in 2024
import pandas as pd
TARGET = 5_000_000
TARGET_RATE = TARGET / 366
data = [
('January', 31, 271_347),
('February', 29, 321_084),
('March', 31, 424_562),
('April', 30, 412_478),
('May', 31, 442_295),
@luispedro
luispedro / connect-qr-code.py
Last active July 8, 2023 19:09
Connect to a WiFi networks using a QR code
import re
import cv2
import subprocess
pat = re.compile(r'^WIFI:S:([^;]+);T:WPA;P:([^;]+);;')
detect = cv2.QRCodeDetector()
cv2.namedWindow("preview")
vc = cv2.VideoCapture(0)
rval, frame = vc.read()
import COVID19Py
covid19 = COVID19Py.COVID19()
locations = covid19.getLocations(timelines=True)
UK = '2020-12-03T00:00:00Z'
EU = set(['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LU', 'MT', 'NL', 'PL', 'RO', 'SK', 'SI', 'ES', 'SE'])
tot = 0
for loc in locations:
if loc['country_code'] in EU:
tim = loc['timelines']['deaths']['timeline']

Keybase proof

I hereby claim:

  • I am luispedro on github.

  • I am luispedro (https://keybase.io/luispedro) on keybase.

  • I have a public key ASBto9ey42rmyXUsEJflex23RWhAlqOiCzmCroSke7XYigo

# %matplotlib qt
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from matplotlib import style
style.use('default')
TOTAL_POP = 100_000
MAX_ITERS = 100_000
rho = 0.5
import pymc3 as pm
from scipy import stats
import numpy as np
NR_TESTS = 3330
POSITIVES = 50
PRE_NEG = 401
PRE_NEG_POS = 2
PRE_PLUS = 37+75+85
# for Emacs: -*- coding: utf-8 -*-
# Originally found on the internet. Not my work
include "%L"
# def emit(keys, codepoint, word):
# print ('<Multi_key> %s <period>\t: "%s"\tU%04X\t\t# CIRCLED DIGIT %s' %
# (keys, unichr(codepoint), codepoint, word)).encode('utf8')
@luispedro
luispedro / simulate-china-us-pop.py
Last active January 26, 2020 12:08
Simulate population
import numpy as np
# FROM
# http://worldpopulationreview.com/countries/china-population/
pyramid0china = np.array(
[16446861., 16821572., 17097250., 17284418., 17390933., 17423080.,
17403550., 17341743., 17247061., 17129365., 16998517., 16861620.,
16727156., 16605907., 16498945., 16404588., 16387661., 16480191.,
Tiny animal-like things living in and around
people do many things. Some of these animal-like
things are good for us, others are bad, and, for
many, we do not know anything about them. We want
to know more.
How these small animal-like things look and act
comes from what is written inside them, which we
can only read if it is broken up in pieces. We use
computers to try to put these pieces together and
@luispedro
luispedro / environment.yml
Created January 23, 2019 03:22
Conda conflict
name: ngless-bench-env
channels:
- bioconda
- conda-forge
- defaults
dependencies:
- subread=1.6.1=0
- bottle=0.12.13=py36_0
- jug=1.6.5=py_0
- pyyaml=3.12=py36_1