Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View briatte's full-sized avatar

François Briatte briatte

View GitHub Profile
@steven2358
steven2358 / ffmpeg.md
Last active April 21, 2024 02:08
FFmpeg cheat sheet
################################################################################
#
# ikashnitsky.github.io 2017-12-10
# Data acquisition in R 3/4
# https://ikashnitsky.github.io/2017/data-acquisition-three
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#
################################################################################
@chrishanretty
chrishanretty / threepeat.R
Created December 5, 2017 17:04
Three elections in three years
require(tidyverse)
require(lubridate)
#Data from www.parlgov.org
dat <- read.csv("view_election.csv")
dat <- dat %>%
filter(election_type != "ep") %>%
mutate(election_date = as.Date(election_date)) %>%
filter(election_date > as.Date("1945-01-01")) %>%
distinct(country_name, election_date) %>%
group_by(country_name) %>%
@johngruen
johngruen / userChrome.css
Last active January 6, 2024 06:23
kill drag space
/*
Create a userChrome.css file by finding your Firefox profile,
making a directory called chrome and in it, a file called userChrome.css inside that.
Pasting this CSS and restarting Firefox will kill the left drag strip
*/
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
.titlebar-placeholder[type="pre-tabs"] {
width: 2px !important;
@jeroen
jeroen / canny.R
Last active April 1, 2021 14:20
Magick canny edge detector
library(magrittr)
library(magick)
image_read("logo:") %>%
image_convert('png', colorspace = 'gray') %>%
image_edge(radius = 1) %>%
image_negate() %>%
image_transparent('white', 10000) %>%
image_background("white") %>%
image_browse()
@ikashnitsky
ikashnitsky / NEET-in-Europe.R
Last active January 24, 2018 05:14
Young people neither in employment nor in education and training in Europe, 2000-2016
################################################################################
#
# ikashnitsky.github.io 2017-07-18
# Accessing Eurostat data using the `eurostat` R package
# Young people neither in employment nor in education and training in Europe
# Ilya Kashnitsky, ilya.kashnitsky@gmail.com
#
################################################################################
library(tidyverse)

Keybase proof

I hereby claim:

  • I am briatte on github.
  • I am briatte (https://keybase.io/briatte) on keybase.
  • I have a public key whose fingerprint is CF1D 937F 13FD 11F4 9060 57C7 EC0B 0E46 6A4C 4EDE

To claim this, I am signing this object:

@chrishanretty
chrishanretty / conswing.R
Last active April 24, 2017 20:45
Analysis of swings in Conservative and Labour-held seats, BES data
library(foreign) ## for data import
library(dplyr) ## for chaining ops together
library(ggplot2) ## for plotting
library(reshape2) ## for reshaping
library(hrbrthemes) ## for pretty pictures
library(survey) ## for... uh, survey data
party.colours <- c("#0087DC","#D50000","#FDBB30","#FFFF00","#008142","#99CC33","#70147A","#DDDDDD")
bes <- read.spss("~/Dropbox/2017-forecasting/data/individual/BES2015_W10_Panel_v0.3.sav")
@conormm
conormm / r-to-python-data-wrangling-basics.md
Last active March 26, 2024 11:44
R to Python: Data wrangling with dplyr and pandas

R to python data wrangling snippets

The dplyr package in R makes data wrangling significantly easier. The beauty of dplyr is that, by design, the options available are limited. Specifically, a set of key verbs form the core of the package. Using these verbs you can solve a wide range of data problems effectively in a shorter timeframe. Whilse transitioning to Python I have greatly missed the ease with which I can think through and solve problems using dplyr in R. The purpose of this document is to demonstrate how to execute the key dplyr verbs when manipulating data using Python (with the pandas package).

dplyr is organised around six key verbs:

msg <- function(..., prob = 0.25) {
if (runif(1) > prob) {
return(invisible())
}
messages <- c(...)
message(sample(messages, 1))
}
encourage <- function() {