Skip to content

Instantly share code, notes, and snippets.

View wilsonfreitas's full-sized avatar

Wilson Freitas wilsonfreitas

View GitHub Profile
f <- function(x) cos(x*20)
expi <- function(x) cos(x) + sin(x)*1i
par(mfrow = c(1,2))
L <- 40
medias_Re <- c()
fs <- c()
as <- seq(0.01, 1, l = 140)
animation::saveGIF({
for(a in as) {
@ih2502mk
ih2502mk / list.md
Last active June 14, 2025 01:45
Quantopian Lectures Saved
# =======================================
# = Enhancements to data tidying =
# = Hadley Wickham =
# = https://rstd.io/tidyhancements-2019 =
# =======================================
# What is tidy data? ----------------------------------------------------------
# 1. Each column is a variable.
# 2. Each row is an observation.
# 3. Each cell is a value.
@jthomasmock
jthomasmock / rstudio-conf-tacos.rmd
Last active January 12, 2019 22:27
A map of the best tacos in Austin for RStudio::Conf via Caitlin Hudon
---
title: "The Best Tacos in Austin according to Caitlin Hudon"
output:
flexdashboard::flex_dashboard:
orientation: column
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
upper <- seq(0, pi, length.out = 181)[-181]
upper <-cbind(x = cos(upper), y = sin(upper))
lower <- seq(pi, 2*pi, length.out = 181)[-181]
lower <- cbind(x = cos(lower), y = sin(lower))
right <- seq(1.5*pi, 2.5*pi, length.out = 181)[-181]
right <- cbind(x = cos(right), y = sin(right))
left <- seq(0.5*pi, 1.5*pi, length.out = 181)[-181]
left <- cbind(x = cos(left), y = sin(left))
full <- cbind(x = cos(seq(0, 2*pi, length.out = 361)[-361]),
y = sin(seq(0, 2*pi, length.out = 361)[-361]))
library(tidyverse)
# Colliders
x1 <- rnorm(1000)
y <- 1.2 + 1.6 * x1 + rnorm(1000)
z <- 0.6 + 1.3*x1 + 1.5*y + rnorm(1000)
@biazzotto
biazzotto / validar_renavam.py
Last active February 3, 2017 10:42
Função para validar sequência de dígitos do Renavam
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Função para validar sequência de dígitos do Renavam.
# Adaptado por Fabricio Biazzotto, a partir do original, feito em java:
# http://blog.victorjabur.com/2010/05/28/renavam_veiculos_java
def validar_renavam(renavam):
# Retorna falso caso o valor passado não seja um número inteiro
@klmr
klmr / generator.md
Last active August 28, 2022 02:26
Python-like generators in R

A little experiment using restarts.

(And while we’re at it, let’s torture R’s syntax a little.)

![screenshot][]

In the following we will be using R’s “restarts” feature to implement the state machine that drives generators in languages such as Python. Generators allow lazily generating values on demand: a consumer invokes a generator, and consumes values as they are produced. A new value is only produced once the previous one has been consumed.

@drgarcia1986
drgarcia1986 / schools_async.py
Created June 29, 2015 21:59
Escolas, em funcionamento, sem água, energia e esgoto, mostrando alguns detalhes (versão asyncio) (baseado em https://gist.github.com/fmasanori/4d6b7ea38a28681a513a)
import asyncio
import json
import aiohttp
SCHOOL_URL_FMT = 'http://educacao.dadosabertosbr.com/api/escola/{}'
SEARCH_SCHOOL_URL = (
'http://educacao.dadosabertosbr.com/api/escolas/buscaavancada?'
'situacaoFuncionamento=1&energiaInexistente=on&aguaInexistente=on&'
@wilsonfreitas
wilsonfreitas / gist:bbcebe9546282c0e7a2b
Last active November 14, 2020 20:54
Listagem de CURVAS B3
Curva Cód.
AJUSTE CUPOM ACC
AÇÚCAR CRISTAL ACF
ALUMÍNIO(US$) ALD
ALUMÍNIO(R$) ALR
ALUMÍNIO(US$) MD AMD
ALUMÍNIO(R$) MD AMR
DI X ANBID AN
ANBID X PRÉ ANP
AJUSTE PRÉ APR