Skip to content

Instantly share code, notes, and snippets.

View ekaitz-zarraga's full-sized avatar
🏠
Working from home

Ekaitz Zárraga ekaitz-zarraga

🏠
Working from home
View GitHub Profile
@ekaitz-zarraga
ekaitz-zarraga / convertMaki.sh
Created November 28, 2017 16:48
Convert Maki Icons to PNG in different colors
#!/bin/bash
# LICENSE:
# Copyright © 2017 Ekaitz Zárraga <ekaitz.zarraga@protonmail.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 the COPYING file for more details.
# Convert certain icons from Mapbox Maki icons to PNGs in different colors
@ekaitz-zarraga
ekaitz-zarraga / index.js
Last active December 4, 2017 10:30
Robohydra frontend-dev-proxy to use with figwheel
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
ekaitz-zarraga / cryptonight.coffee
Last active January 2, 2018 14:16
Pseudocode for CryptoNight made in CoffeeScript
# Pseudocode for Cryptonight
# --------------------------
#
# Written in CoffeeScript for simplicity but untested.
# See:
# https://cryptonote.org/cns/cns008.txt
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ekaitz-zarraga
ekaitz-zarraga / whiteboardCleaner.md
Created May 24, 2018 16:50 — forked from lelandbatey/whiteboardCleaner.md
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

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:

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

Results

@ekaitz-zarraga
ekaitz-zarraga / Philosophy.md
Last active August 11, 2018 13:50
MH Electronics FAQ

What is this about?

This is about hacking, in both the meanings explained in the following quote:

"It's called a hack when you do something in an ugly way. But when you do something so clever that you somehow beat the system, that's also called a hack.

The word is used more often in the former than the latter sense, probably because ugly solutions are more common than brilliant ones.

@ekaitz-zarraga
ekaitz-zarraga / bisection.clj
Last active January 24, 2019 09:18
Example code for Bisection method in Clojure
; Example code for Bisection method
; https://en.wikipedia.org/wiki/Bisection_method
(defn f
"Example function to apply algorithm on"
[x]
(+ 3 x))
(defn distance
[a b]
(ns asktodon.storage
(: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."
[client-data-file]
(try
(read-string (slurp client-data-file))
(catch Exception e
@ekaitz-zarraga
ekaitz-zarraga / table.py
Created November 5, 2016 12:57
Easy and simple table printer for python
class Table:
"""
Simple terminal table printer:
| col1 | col2 | col3 |
-------+-------+-------+-------+
row1 | 1 | 2 | 3 |
-------+-------+-------+-------+
row2 | 4 | 5 | 6 |
-------+-------+-------+-------+
@ekaitz-zarraga
ekaitz-zarraga / gol_example.js
Created March 1, 2023 13:17
A minimal and dirty example of Conway's Game of Life in javascript
let grid = [
[0, 0, 0],
[1, 1, 1],
[0, 0, 0]
];
function vecinasPosibles(x,y,grid){
return [
[x-1,y-1],[x+0,y-1],[x+1,y-1],
[x-1,y+0], [x+1,y+0],
@ekaitz-zarraga
ekaitz-zarraga / mymap.js
Created March 3, 2023 13:24
a JavaScript Map that compares keys by equality and not by reference LUL
function MyMap(){
this.map = new Map();
}
MyMap.prototype.set= function(k,v){
this.map.set(JSON.stringify(k), v);
}
MyMap.prototype.get= function(k){
return this.map.get(JSON.stringify(k));
}