Skip to content

Instantly share code, notes, and snippets.

View rinze's full-sized avatar

José María Mateos rinze

View GitHub Profile
@rinze
rinze / lineas_rojas.R
Created December 21, 2015 21:37
Generador automático de líneas rojas para partidos políticos.
library(ggplot2)
NLINEAS <- 20
coords <- data.frame(x1 = runif(NLINEAS, 0, 10),
x2 = runif(NLINEAS, 0, 10),
y1 = runif(NLINEAS, 0, 10),
y2 = runif(NLINEAS, 0, 10))
plt1 <- ggplot(coords) + geom_segment(aes(x = x1, xend = x2,
library(readr)
library(dplyr)
library(ggplot2)
get_first_digit <- function(x) {
return(substr(x, 1, 1))
}
votes <- read_csv("https://github.com/Prooffreader/election_2016_data/raw/master/data/presidential_general_election_2016_by_county.csv")
@rinze
rinze / python_environment_setup.md
Created September 24, 2018 17:43 — forked from Geoyi/python_environment_setup.md
Setting up your python development environment (with pyenv, virtualenv, and virtualenvwrapper)

Overview

When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. That way you can keep each project in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. This intermediate guide covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda). See the Using the workflow section to view the end result.

Use cases

  1. Working on 2+ projects that each have their own dependencies; e.g., a Python 2.7 project and a Python 3.6 project, or developing a module that needs to work across multiple versions of Python. It's not reasonable to uninstall/reinstall modules every time you want to switch environments.
  2. If you want to execute code on the cloud, you can set up a Python environment that mirrors the relevant
@rinze
rinze / plot_map.R
Created April 18, 2020 16:11
Plot code for https://rinzewind.org/blog-es/2020/donde-estamos.html Not pretty, but it does its job.
library(ggplot2)
theme_set(theme_bw(12))
data1 <- data.frame(location = c(rep(0, 10), 1:100, rep(100, 200), 100:1, rep(0, 10)),
style = 1)
#data1$style[(nrow(data1)-30):nrow(data1)] <- 2
data1$idx <- 1:nrow(data1)
plt1 <- ggplot(data1) + geom_line(aes(x = idx, y = location,
linetype = factor(style)),
@rinze
rinze / Dockerfile-poc
Last active September 23, 2022 20:10
Files for kaniko issue #2261
FROM ubuntu:18.04
RUN apt-get update \
&& apt-get dist-upgrade -y \
&& apt-get install -y wget gcc g++ redis supervisor libgl1 sudo \
vim less htop \
webp libwebp-dev \
&& apt-get clean
RUN sudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf