View pong.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
View collatz.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
View cloudsend.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
############################################################ | |
# | |
# cloudsend.sh | |
# | |
# Uses curl to send files to a shared | |
# Nextcloud/Owncloud folder | |
# | |
# Usage: ./cloudsend.sh <file> <folderLink> |
View .vimrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mapleader="," | |
set laststatus=2 | |
set colorcolumn=81 | |
highlight ColorColumn ctermbg=8 | |
set number | |
set cursorline | |
set wildmenu | |
set showmatch |
View yield.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <setjmp.h> | |
#include <math.h> | |
#include <time.h> | |
typedef struct process { | |
double *now; | |
double (*run)(struct process *); | |
jmp_buf buf; |
View loadhdf5data.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' @param h5File HDF5 file path | |
#' @param dataset data frame path in the HDF5 file | |
#' @examples | |
#' df <- loadhdf5data("/path/to/file.hdf5", "/path/to/dataset") | |
#' | |
loadhdf5data <- function(h5File, dataset) { | |
require(h5) # available on CRAN | |
f <- h5file(h5File) | |
nblocks <- h5attr(f[dataset], "nblocks") |
View git-remove.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
View get_wikipedia_events.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# coding=UTF8 | |
# Author: Iñaki Ucar <i.ucar86@gmail.com> | |
# Description: Download all events, births and deaths from Wikipedia | |
import sys, requests, locale | |
from datetime import date, timedelta as td | |
from pypandoc import convert # <3 | |
MAX_TITLES = 50 |
View chirp.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clap = audioread('clap.wav'); | |
fs = 96e3; % sampling frequency | |
N = 40; % steps | |
ssize = 0.15; % step size | |
delay = ssize * 2 / 340; | |
samples = round(delay * fs); | |
stairs = zeros(samples * N + length(clap) + N, N); | |
for i = 1:N | |
samples = samples + 1; | |
indexes = (i-1)*samples+1 : length(clap)+(i-1)*samples; |
View init.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
NewerOlder