Skip to content

Instantly share code, notes, and snippets.

View nihilismus's full-sized avatar

Antonio Hernández Blas nihilismus

View GitHub Profile
@nihilismus
nihilismus / infinality-fonts-local-install.sh
Created November 1, 2016 12:01
infinality-fonts-local-install.sh: install the latest versions available of Infinality fonts in $HOME/.local/share/fonts
#!/bin/bash
# infinality-fonts-local-install.sh: download the latest versions available of
# Infinality fonts: http://bohoomil.com/repo/fonts/
# and install them into $HOME/.local/share/fonts
# Copyright © 2016 Antonio Hernández Blas <hba.nihilismus@gmail.com>
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
@nihilismus
nihilismus / XHR.js
Created May 22, 2016 18:09
Módulo de JavaScript / XMLHttpRequest, similar al encontrado en https://gist.github.com/nihilismus/ebbf0e1a2dd8e4ef6a8b
var XHR = (function() {
var _get = function(_url, _en_caso_de_exito, _en_caso_de_error) {
var _detectar_cambios_de_estado = function(_xhr, _en_caso_de_exito, _en_caso_de_error) {
return function() {
if (_xhr.readyState === 4) {
if (_xhr.status >= 200 && _xhr.status <= 299) {
_en_caso_de_exito(_xhr);
} else {
_en_caso_de_error(_xhr);
}
@nihilismus
nihilismus / startx-linux-tty1.sh
Created May 15, 2016 16:17
Execute startx automatically in a linux system (/dev/tty1 or Ctrl+Alt+F1)
#!/bin/bash
# sdm.sh : Start X **automagically** when login-in /dev/tty1
#
# Add the execution of this script, or the next lines, at the
# end of ~/.bashrc or ~/.bash_profile
TTY="$(/usr/bin/tty | sed 's:.*/::')"
if [[ ! ${DISPLAY} && ${TERM} == 'linux' && ${TTY} == 'tty1' ]]; then
unset TTY
exec startx
@nihilismus
nihilismus / fos.clj
Last active May 20, 2016 05:31
Funciones de Orden Superior y Funciones Sobre Colecciones en Clojure haciendo uso de recursividad (first, rest y conj)
(def lmap (fn [f xs]
(letfn [(g ;; Función Recursiva (FR): recorre la LO para regresar la LA conformada con los resultados
;; obtenidos de aplicar la FA sobre cada E en la LO.
;; Elemento (E): es cada valor (val) en la LO
;; '(valor1 valor2 valorN)
[ys ;; Lista Original (LO) o Lista de Entrada (LE)
zs ;; Lista de Acumulación (LA) o Lista de Salida (LS)
h ;; Función a Aplicar (FA)
]
(if (nil? (first ys))
@nihilismus
nihilismus / atom-beta-update.sh
Last active June 14, 2016 05:50
atom-beta-update.sh: download & install in openSUSE the latest Beta version of Atom from GitHub
#!/bin/bash
# atom-beta-update.sh: download the latest Beta version of Atom from
# GitHub: https://atom.io/beta
# Copyright © 2016 Antonio Hernández Blas <hba.nihilismus@gmail.com>
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
@nihilismus
nihilismus / startvnc.sh
Created March 25, 2016 04:10
startvnc.sh: starts x11vnc to share the desktop (DISPLAY=:0)
#!/bin/sh
# startvnc.sh: starts x11vnc to share the desktop (DISPLAY=:0).
# Use -f to force stop and start a new instance of x11vnc.
# Copyright © 2016 Antonio Hernández Blas <hba.nihilismus@gmail.com>
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
@nihilismus
nihilismus / kde5-plasma-antu.sh
Last active April 3, 2016 18:48
kde5-plasma-antu.sh: install Antü Plasma Suite (KDE) in openSUSE, from it's GitHub repository, inside $HOME.
#!/bin/sh
# kde5-plasma-antu.sh: install/update Antü Plasma Suite [1], an
# "elegant Alternative Suite for Plasma 5" by Fabián Alexis.
#
# The installation is made inside $HOME/.local/share.
#
# This script was tested only in:
# $ cat /etc/os-release
# NAME=openSUSE
/*
XHR.get_csv({
"url": "http://127.0.0.1:8080/csv/nombres.csv",
"en_caso_de_exito": function(resultado) { console.log(resultado); },
"en_caso_de_error": function(resultado) { console.log(resultado); }
});
XHR.head_csv({
"url": "http://127.0.0.1:8080/csv/nombres.cs",
(ns funciones.recursivas)
;; Fuentes:
;; http://www.cs.us.es/~jalonso/cursos/i1m-15/temas/tema-6.html
;; http://www.glc.us.es/~jalonso/vestigium/i1m2015-ejercicios-de-definiciones-por-recursion/
;; Recursión numérica
(defn factorial01
[n]
var a = (function() {
var _colorear = function() {
var colores = ["red", "blue", "pink", "yellow"];
var celdas_alrededor = function(celda) {
var obj_salida = { "arriba": undefined, "derecha": undefined, "abajo": undefined, "izquierda": undefined };
var indice = celda.cellIndex;
/* Celda de arriba */
if (celda.parentElement.previousElementSibling !== null) {