Skip to content

Instantly share code, notes, and snippets.

View JJ's full-sized avatar
🏠
Working from home

Juan Julián Merelo Guervós JJ

🏠
Working from home
View GitHub Profile
@JJ
JJ / .bashrc
Last active August 29, 2015 13:59 — forked from justintv/.bashrc
# If you work with git, you've probably had that nagging sensation
# of not knowing what branch you are on, or worse, you pull the wrong branch.
# Worry no longer!
export PS1="\\w<\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)>$ "
# This will change your prompt to display not only your working directory but also your current git branch, if you have one.
#~/txt/ocio/HashSlash<master>$ git checkout writer
#Switched to branch 'writer'
#~/txt/ocio/HashSlash<writer>$ git checkout master
@JJ
JJ / pre-commit
Last active August 29, 2015 14:00 — forked from ilyakatz/pre-commit
#!/bin/bash -l
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
#
.git/hooks/pre-commit-master-no-no
if [[ $? == 1 ]]
then
@JJ
JJ / resumen.gs
Created October 28, 2014 19:20
Google Spreadsheet: extrae información de una hoja y la copia en otra
/**
Esta función lee datos de una hoja de cálculo que contiene el nombre del proyecto y los dos URLs que buscamos: repo y web, en las columnas 1, 3 y 19 de la hoja de cálculo (respuestas a un formulario en Google Spreadsheet). Los escribe en tres columnas de otra hoja de cálculo, previo borrado de la misma
Funciona con Herramientas->Editor de secuencias de comandos. La primera vez que lo ejecutes sobre una hoja de cálculo tendrás que autorizarla. Aparte, hay que crear una segunda hoja de cálculo resumen y copiar el id para sustituir donde pone *unIdCualquiera*
El resultado de la ejecución está aquí: https://docs.google.com/spreadsheets/d/1RE2yPUs67D2AsQuo59Pj5ROSB3_4WTKqF0HmN3gupRw/edit?usp=sharing
*/
function summarize_projects() {
var sheet = SpreadsheetApp.getActiveSheet();
var output_sheet = SpreadsheetApp.openById("unIdCualquiera")
@JJ
JJ / top-github-users-dec-2014.md
Last active March 5, 2021 01:25
Top GitHub users

Most active GitHub users

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Tue, 03 Dec 2013 07:25:57 GMT till Wed, 03 Dec 2014 07:25:57 GMT.

Only first 1000 GitHub users according to the count of followers and with more than a hundred repos are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.followers &gt; 101 &amp; user.repos &gt; 101)
@JJ
JJ / github-user-stats-dec-2014.json
Created December 3, 2014 16:29
Top GitHub users Dec 2014 (filtered by number of followers and repos > 100)
[
{
"name": "♩ Ionică Bizău ♫ ♪",
"login": "IonicaBizau",
"location": "Romania",
"language": "JavaScript",
"gravatar": "https://avatars3.githubusercontent.com/u/2864371?v=3&s=400",
"followers": 150,
"organizations": [
"jillix",
@JJ
JJ / top-github-users-granada.md
Created December 4, 2014 06:21
Top GitHub users, Dec 2014, Granada

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 04 Dec 2013 06:20:22 GMT till Thu, 04 Dec 2014 06:20:22 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.followers &gt; 1)
@JJ
JJ / paras.pl
Created December 15, 2014 12:52
Write standard input or files as paragraphs in an HTML correct page
#!/usr/bin/env perl
use CGI qw(:standard);
use strict;
use warnings;
use v5.14; # Para say
my @parrafos = <>;
say start_html("Salida de párrafos");
for my $p (@parrafos) {
@size = (1920, 1080);
@center = (-.743653135, .131826563);
$zoom = .000014628;
$max_it = 700;
$oversample = 2;
$_ *= $oversample for (@size);
open $fh, "|-", "convert -size ".join("x",@size)." -depth 8 gray:- ".
"-resize ".(100/$oversample)."% mandel.png";
for $py (1 .. $size[1]) {
@JJ
JJ / Submitting Rmd to Arxiv.md
Last active April 12, 2022 08:00
Submitting RMarkdown articles to Arxiv

Mini-HowTo submit RMarkdown articles to ArXiV

ArXiV is a place for publishing scientific technical reports and drafts which is tightly tied to LaTeX. That is why if you generate a PDF from your RMarkdown article it will tell you, hey, this has been generated using LaTeX, I want the LaTeX source. In principle, RStudio does not admit LaTeX as a final format, only .doc, .pdf or HTML. But it is no big deal.

You only need to add this to the metadata in the RMarkdown document

output: 
  pdf_document:
    keep_tex: true
@JJ
JJ / get-diffs.pl
Created August 28, 2016 17:13
Extract number of lines changed per commit in a downloaded repository
#!/usr/bin/env perl
=head1 NAME
get-diffs.pl - Quantify diffs in a software repository
=head1 SYNOPSIS
First, install needed modules