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 / node-and-npm-in-30-seconds.sh
Last active January 3, 2016 11:59 — forked from isaacs/node-and-npm-in-30-seconds.sh
Installing node in a very raw box (like the one provided by docker). It will take a bit more than 30 seconds, somehow
#Problem with this is that it needs lots of installed stuff, so I'll put it here
# sudo or admin shell is presupposed
apt-get install make curl python-setuptools gcc g++
#Maybe you can safely supress make and gcc from here, since they are dependencies of g++
#Then you can proceed to the original set
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir /usr/local
mkdir ~/node-latest-install
@JJ
JJ / git-hooks.pl
Created August 26, 2013 17:07
Git post-commit hook for modifying .md files to work with gh-pages and just copy other files, like .png, .css and so on.
#!/usr/bin/env perl
use strict;
use warnings;
use v5.14;
use Git::Hooks;
use File::Slurp qw(read_file write_file);
my $layout_preffix=<<EOT;
---
@JJ
JJ / citations.user.js
Created April 20, 2013 09:43
GreaseMonkey script that puts on top of the citation graph the actual number of citations per year; works on the Google Citations page. In old versions of Chrome and Chromium this should work without a problem. In new versions you'll have to get out of your way to install it, so don't bother and just switch to Firefox and install the GreaseMonke…
// ==UserScript==
// @name gcitations
// @namespace http://merelo.net/gmscripts
// @description Compute number of citations per year in Google Citations
// @include http://scholar.google.com/citations*
// ==/UserScript==
var imgs = document.getElementsByTagName('img');
var my_url;
@JJ
JJ / compare_strings_mastermind.c
Last active December 10, 2015 17:18
Compare two strings returning the number of symbols in the correct position ("blacks") and the number of symbols in the wrong position ("whites"), MasterMind style
#include <stdio.h>
#include <string.h>
// with help from http://www.eskimo.com/~scs/cclass/notes/sx13.html
int main( int argc, char *argv[] )
{
char *hidden = argv[1];
char *target = argv[2];
char colors = atoi( argv[3] );
printf( "Hidden %s target %s colors %d\n", hidden, target, colors);
@JJ
JJ / jquery-test.js
Created January 25, 2012 11:15
Prueba con JQuery para el taller de Ajax de la OSLUGR. Un ejemplo mínimo de uso de Ajax con JQuery
$(function(){
$("a.ajax").click((function(){
$.get($(this).attr('href'), function(data){
alert("Ya");
})
.success(function(data){
alert( 'Lo hise' )})
.error(function(data){
alert( 'Pos no' )})
.complete(function(data){
@JJ
JJ / csv_to_net.pl
Created October 24, 2011 12:29
Convert CSV files to Pajek .net format. Takes file with two columns as argument; every row indicates a connection from agent in column A to agent in Column B. Outputs a file with the same root and .net extension in .net format, which can be used in Pajek
#!/usr/bin/perl
use strict;
use warnings;
use File::Slurp qw(read_file);
my $csv = shift || die "No defaults; $0 <csvfile>\n";
my $content = read_file($csv) || die "Can't read file $csv: $!\n";
@JJ
JJ / equipo.xml
Created July 13, 2011 07:48
Pretty-print XML files with user-specified colors and indents
?xml version="1.0"?>
<?xml-stylesheet href="tienda0.xsl" type="text/xsl"?>
<equipo>
<jugador posicion='portero'>Araña</jugador>
<jugador posicion='delantero'>Cazagoles</jugador>
</equipo>