Skip to content

Instantly share code, notes, and snippets.

View GusGA's full-sized avatar
🕶️
Reading someone else's code

Gustavo Giménez GusGA

🕶️
Reading someone else's code
  • Santiago, Chile
View GitHub Profile
@GusGA
GusGA / flatten.erl
Created July 31, 2018 03:06
flatten array
-module(flatten).
-export([flat/1]).
flat(List) -> flat(List, []).
flat([], Acc) -> Acc;
flat([H | T], Acc) -> flat(H, flat(T, Acc));
flat(H, Acc) -> [H | Acc].
@GusGA
GusGA / questions.md
Last active July 10, 2018 01:53
Posible Erlang test questions

When Link to or monitor a erlang process

Link

  • Have a dependency on a process (i.e: you can't run if a specific process dies). This fits great into supervisor trees.
  • Have a bidirectional dependency, where a parent can't run if the child dies, and you also want to kill the child if the parent dies in turn.
  • Only need 1 link between processes (remember that if A and B are linked, all subsequent calls to link/2 will be ignored).
  • You are a supervisor, or you want some kind of physical relationship between your processes in your architecture (i.e: you actually need to die or restart or try something out to fix the situation that led to the death of your child.

Monitor

@GusGA
GusGA / mining_guide_ubuntu.markdown
Last active December 21, 2017 15:17
Guía rápida para minar "Litecoin" en Ubuntu

#Guía rápida para el minado de Litecoin en Ubuntu

##Paso 1

###Instalación OpenSSH en maquinas mineras

La conexión a las maquinas mineras se hará via ssh

sudo apt-get install openssh-server
@GusGA
GusGA / strong_params_helpers.rb
Created November 30, 2017 22:05 — forked from BGuimberteau/strong_params_helpers.rb
Strong parameters with grape
module StrongParamsHelpers
extend Grape::API::Helpers
def permitted_params
@permitted_params ||= declared(params, include_missing: false, include_parent_namespaces: false)
end
end
@GusGA
GusGA / video_downloader.rb
Created July 30, 2017 17:24
Descargas videos de listados m3u8
require 'smarter_csv'
require 'i18n'
require 'uri'
I18n.config.available_locales = :en
def filename(index, name)
new_name = I18n.transliterate(name.split(' ').map(&:downcase).join('_')).gsub("?",'')
return "#{index + 1}_#{new_name}.mp4"
end
@GusGA
GusGA / herroku_deploy.sh
Created April 9, 2017 17:29
Heroku Deploy by Mark Bates
#!/bin/bash
set -ex
git checkout -b build
GOOS=linux buffalo build -z -o bin/heroku
git add .
git commit -a -m "binary commit"
git push heroku build:master --force
heroku run bin/heroku migrate
@GusGA
GusGA / salsa.md
Created September 9, 2016 22:55
Salsa Picante Dulce
  • 2 kilos de aji chire con semilla
  • 4 kilos de aji dulce criollo rojito el largito con semilla
  • 1 ½ kilos de cebolla
  • 1 ½ kilos de pimenton rojo sin semilla (puede ser rocoto)
  • ½ kilo de ajo
  • ¾ taza de vinagre
  • ¾ taza de agua
  • Sal al gusto

El dulce

set encoding=utf-8
set nocompatible " We're running Vim, not Vi!
filetype off
:set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'mattn/emmet-vim'
Plugin 'fatih/vim-go'
@GusGA
GusGA / .bashrc
Created December 20, 2015 04:20 — forked from ameboide/.bashrc
para hacer hotfixes y releases con `hotfix` y `release` y no olvidarse de la version y el changelog
#log de commits locales que no se han pusheado
alias gl='git log --branches --not --remotes --decorate'
alias gs='git status'
alias gf='git fetch origin'
alias gd='git difftool --tool=meld -d HEAD &'
alias ga='git add -u .;git add .'
alias gb='git branch -a'
gr(){
git reset $*
@GusGA
GusGA / al-livelog.sh
Last active February 29, 2016 18:44
Git repo real time status
#!/bin/bash
while :
do
clear
date +"%A %B %d, %Y at %T"
lines=`tput lines`
lines=`expr $lines - 5`
git --no-pager log --color --all --pretty='format:%C(auto)%d%Creset %C(yellow)%h%Creset %C(green)%an%Creset - %s - %C(cyan)%cr%Creset' --graph $* | head -n $lines
sleep 1