Skip to content

Instantly share code, notes, and snippets.

Working from home

Ekaitz Zárraga ekaitz-zarraga

Working from home
View GitHub Profile
ekaitz-zarraga / MYSQL_SESSION_EXAMPLE.txt
Created March 17, 2023 08:32
Example session in MySQL from scratch: Creates a user for password auth and a database.
alumno ~$ sudo apt install mysql-server mysql-client
[sudo] contraseña para alumno:
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias
Leyendo la información de estado... Hecho
mysql-client ya está en su versión más reciente (8.0.32-0ubuntu0.20.04.2).
mysql-server ya está en su versión más reciente (8.0.32-0ubuntu0.20.04.2).
0 actualizados, 0 nuevos se instalarán, 0 para eliminar y 16 no actualizados.
alumno ~$ sudo mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
ekaitz-zarraga / SQLiteSessionExample.txt
Created March 14, 2023 12:25
Example SQLite session with keys and a lot of fun
View SQLiteSessionExample.txt
$ sqlite3 DATOS.db
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
sqlite> .read tareas.sql
sqlite> .dump
PRAGMA foreign_keys=OFF;
CREATE TABLE personas(
name TEXT
ekaitz-zarraga / markov_greeter.js
Last active March 6, 2023 17:06
Markov text generator example ftw. Run with `node markov_greeter.js` several times to watch it do its magic.
View markov_greeter.js
let areYou = {
value: " are you!",
transitions: []
let questionMark = {
value: "?",
ekaitz-zarraga / mymap.js
Created March 3, 2023 13:24
a JavaScript Map that compares keys by equality and not by reference LUL
View mymap.js
function MyMap(){ = new Map();
MyMap.prototype.set= function(k,v){, v);
MyMap.prototype.get= function(k){
ekaitz-zarraga / gol_example.js
Created March 1, 2023 13:17
A minimal and dirty example of Conway's Game of Life in javascript
View gol_example.js
let grid = [
[0, 0, 0],
[1, 1, 1],
[0, 0, 0]
function vecinasPosibles(x,y,grid){
return [
[x-1,y+0], [x+1,y+0],
ekaitz-zarraga / bisection.clj
Last active January 24, 2019 09:18
Example code for Bisection method in Clojure
View bisection.clj
; Example code for Bisection method
(defn f
"Example function to apply algorithm on"
(+ 3 x))
(defn distance
[a b]
View storage.clj
(:require [clojure.core.async :as a]))
(defonce client-data-file "client-data.edn")
(defn- load-client-data
"Load client data file, supposed to be done only once."
(read-string (slurp client-data-file))
(catch Exception e
ekaitz-zarraga /
Created May 24, 2018 16:50 — forked from lelandbatey/
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!


This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"


ekaitz-zarraga / index.js
Last active December 4, 2017 10:30
Robohydra frontend-dev-proxy to use with figwheel
View index.js
var heads = require("robohydra").heads,
RoboHydraHeadProxy = heads.RoboHydraHeadProxy,
RoboHydraHeadFilesystem = heads.RoboHydraHeadFilesystem;
// Configuration variables:
// * urlfigwheel: url to proxy to figwheel
// * urlproxy: url to proxy
// * figwheelto: remote URL of the figwheel server. Defaults to 'http:localhost:3449'
// * proxyto: remote URL of the proxy.
// * sethostheader: if the "Host" header should be set to the URL the
ekaitz-zarraga /
Created November 28, 2017 16:48
Convert Maki Icons to PNG in different colors
# Copyright © 2017 Ekaitz Zárraga <>
# 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 the COPYING file for more details.
# Convert certain icons from Mapbox Maki icons to PNGs in different colors