Skip to content

Instantly share code, notes, and snippets.

View Enchufa2's full-sized avatar

Iñaki Ucar Enchufa2

View GitHub Profile
@Enchufa2
Enchufa2 / cchecks-rules.R
Last active September 24, 2020 16:58
This snippet monitors your R packages' CRAN Package Check Results page and notifies you by email if there are any changes.
#remotes::install_github("ropensci/cchecks")
library(cchecks)
myaddress <- whoami::email_address()
# cchn_register(myaddress)
pkgs <- cch_maintainers(sub("@", "_at_", myaddress))$data$packages
msgs <- c("warn", "error")
rules <- lapply(pkgs$package, function(pkg) list(package=pkg))
@Enchufa2
Enchufa2 / collatz.c
Created July 30, 2021 23:02
Collatz's conjecture + GMP games
#include <stdio.h>
#include <gmp.h>
int main() {
mpz_t x, y, odd_or_even;
mpz_init(x);
mpz_init(y);
mpz_init(odd_or_even);
unsigned long int i, p;
@Enchufa2
Enchufa2 / git-remove.sh
Last active September 17, 2021 12:10
Remove and purge old mistakes and/or unwanted big files from git history
#!/bin/bash
# Remove and purge old mistakes and/or unwanted big files from git history
# author: Iñaki Ucar <i.ucar86@gmail.com>
# based on: http://blog.ostermiller.org/git-remove-from-history
if [ "$#" -ne 2 ]; then
echo "usage: $0 <repo-URL> <pattern>"
exit 1
fi
@Enchufa2
Enchufa2 / pong.R
Last active July 24, 2022 12:04
Pong in R
# remotes::install_github("coolbutuseless/eventloop")
Pong <- R6::R6Class(
"pong",
public = list(
initialize = function(width=10, height=7, speed=0.02) {
require(grid)
private$width <- width
private$height <- height
@Enchufa2
Enchufa2 / sim.py
Last active March 13, 2023 11:43
Simple simulation core in Python and M/M/1 queueing example
#!/usr/bin/env python2
# coding=UTF8
# Author: Iñaki Ucar <i.ucar86@gmail.com>
# Description: Simple simulation core in Python and M/M/1 queueing example
from heapq import heappop, heappush
class Simulator(object):
"""Simulation environment"""
@Enchufa2
Enchufa2 / transcription_from_video.py
Last active December 25, 2023 11:58
Extract a transcribed score from a video to PDF
#!/bin/python3
import argparse, textwrap
import cv2 as cv
import numpy as np
from pathlib import Path
from fpdf import FPDF
from tempfile import NamedTemporaryFile
class Selector(object):