Skip to content

Instantly share code, notes, and snippets.

View werelax's full-sized avatar

Elías Alonso werelax

View GitHub Profile
@werelax
werelax / csv-viewer.sh
Created April 5, 2017 20:21
ghetto CSV tools
#!/bin/sh
#
# Usage: ./csv-viewer.sh ';' input.csv
#
iconv -f utf8 -t ascii//TRANSLIT $2 | column -s$1 -t | less -S -N
@werelax
werelax / unlock.js
Created March 3, 2017 15:41 — forked from laziel/unlock.js
Unlock Web Audio in iOS 9 Safari
var ctx = null, usingWebAudio = true;
try {
if (typeof AudioContext !== 'undefined') {
ctx = new AudioContext();
} else if (typeof webkitAudioContext !== 'undefined') {
ctx = new webkitAudioContext();
} else {
usingWebAudio = false;
}
@werelax
werelax / deploy-plan.js
Created September 5, 2016 20:42
Simple Flightplan script for simple node.js deployments
'use strict';
const plan = require('flightplan');
// -------------------------
// Targets
plan.target('dev', {
host: 'viviz.bettr.es',
username: 'elias',
@werelax
werelax / from-an-ubuntu-droplet.md
Last active April 5, 2020 14:21
Privision a node server

The first steps

Change the root password (to get a good password: http://passwordsgenerator.net/) and create a non root user:

useradd -m -s /bin/bash not_root
passwd not_root
apt-get update; apt-get install -y nginx sudo
@werelax
werelax / private-key-ssh-howto.md
Last active September 3, 2016 17:17
Generate ssh .pem and .pub files for privateKey-based server auth

Generate a key pair for SSH authentication

Very useful to log into a server without sharing any passwords. A common use case: deploy scripts.

1. Generate the key pair

$ ssh-keygen -t rsa -b 2048 -v

When asked where to put the files, just type key. That would generate two files: ./key.pub and ./key.

@werelax
werelax / local_through_server.sh
Last active July 21, 2016 11:24
Forward and Reverse SSH Tunnels
# Map a local port to a target port through the remote server.
# In the example: localhost:9000 is tunneled to imgur.com:80 through example.com
# local:9000 -> exaple.com -> target:80
# you could browse to http://localhost:9000/ and browse imgur.com
# (won't see anything, because imgur has changed their stack, but the tunnel works)
ssh -L 9000:imgur.com:80 [email protected]
# Useful for: use a server as a proxy, secure a connection (ssh encrypts everything),
@werelax
werelax / getf-in.lisp
Created May 7, 2016 09:13
Common Lisp utilities
(defmacro getf-in (list &rest keys)
(reduce (lambda (acc el) `(getf ,acc ,el))
keys :initial-value list))
;; example
(defparameter jarl '(:a 1 :b 2 :c (:d (:e "yeah"))))
(getf-in jarl :c :d :e) ; => "yeah"
(setf (getf-in jarl :c :d :e) "something else")
@werelax
werelax / button.scad
Created April 28, 2016 20:26
Boton Simplon
// pincho
cylinder(5, 50, 50, true);
translate([0, 0, -100]) cylinder(100, 5, 5);
// tubito
translate([0, 0, -150]) {
difference() {
cylinder(30, 10, 10, true);
@werelax
werelax / html-to-hiccup
Last active September 12, 2015 19:25
convert html to hiccup with hicv
$ lein hicv 2clj maqueta/build/**/*.html
@werelax
werelax / .emacsrc.light.el
Created September 10, 2015 10:05
Super basic emacs config file for quick startup time (alternative setup to use as $EDITOR)
(setq backup-inhibited t
auto-save-default nil)
(menu-bar-mode -1)
;;; package --- Some editing configurations
;;; Commentary:
;;; Code: