Skip to content

Instantly share code, notes, and snippets.

View efontan's full-sized avatar
:shipit:

Emmanuel Fontán efontan

:shipit:
View GitHub Profile
@efontan
efontan / static-server.nginx
Created November 9, 2018 18:04
Nginx config for static content
server {
listen 80;
server_name localhost;
location /static-content/ {
alias /home/user/static-content/;
add_header "Access-Control-Allow-Origin" *;
add_header Timing-Allow-Origin *;
expires 14d;
add_header Pragma public;
@efontan
efontan / install-ubuntu-kernel-4.13-64bit.sh
Created January 12, 2019 22:41
Install Ubuntu kernel 4.13 for 64bit
#!/bin/bash
cd /tmp/
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-headers-4.13.0-041300_4.13.0-041300.201709031731_all.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-headers-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.13/linux-image-4.13.0-041300-generic_4.13.0-041300.201709031731_amd64.deb
sudo dpkg -i *.deb
@efontan
efontan / download-coursera-course.sh
Last active January 15, 2019 04:08
Download all lectures and videos from a Coursera class you are enrolled in.
#!/bin/bash -e
#title : download-coursera-course.sh
#description : Download all lectures and videos from a Coursera class you are enrolled in.
#forked from : https://link.medium.com/agVPPIsauT
#author : ef0ntan
#usage : ./download-coursera-course.sh -c <class-name> -d <download_dir> -i
#parameters :
# -c : Coursera class name in the URL. For example, for "concurrent-programming-in-java"
# Name used in the URL for class: https://www.coursera.org/learn/<CLASS_NAME>/home/welcome
# -d : [OPTIONAL] Directory to download clasee files. Default is ~/Coursera/Classes/
@efontan
efontan / Scala Case Class.scala
Created January 21, 2019 20:45
Scala Case Class - Intellij fileTemplate
#if ((${PACKAGE_NAME} && ${PACKAGE_NAME} != ""))package ${PACKAGE_NAME} #end
#parse("File Header.java")
case class ${NAME}()
@efontan
efontan / Scala Enumeration Template.scala
Created January 21, 2019 21:43
Scala Enumeration - Intellij fileTemplate
#if ((${PACKAGE_NAME} && ${PACKAGE_NAME} != ""))package ${PACKAGE_NAME} #end
#parse("File Header.java")
object ${NAME} extends Enumeration {
type ${NAME} = Value
val ValueOne, ValueTwo = Value
def apply(name: String): ${NAME}.Value = name.toLowerCase() match {
case "valueone" => ValueOne
// ...
@efontan
efontan / enable-paste-bookmark.html
Created March 17, 2019 19:05
Disable paste blockers on forms
javascript:void($('input').attr('onpaste', ''));
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
@efontan
efontan / windows_bash_subsystem_ubuntu_colors.txt
Created May 26, 2019 07:44
Bash subsystem Ubuntu terminal colors
# https://medium.com/@jgarijogarde/make-bash-on-ubuntu-on-windows-10-look-like-the-ubuntu-terminal-f7566008c5c2
Slot 1: Red: 48, Green: 10, Blue: 36
Slot 2: Red: 114, Green: 159, Blue: 207
Slot 3: Red: 48, Green: 10, Blue: 36
Slot 4: Red: 6, Green: 152, Blue: 154
Slot 5: Red: 204, Green: 0, Blue: 0
Slot 6: Red: 117, Green: 80, Blue: 123
Slot 7: Red: 196, Green: 160, Blue: 0
Slot 8: Red: 211, Green: 215, Blue: 207
@efontan
efontan / dolar.sh
Created August 12, 2019 14:21
Cotización del dólar minuto a minuto
#!/bin/bash
while true;
echo -n $(date '+%H:%Mhs ') " "
do curl https://banco.santanderrio.com.ar/exec/cotizacion/index.jsp 2> /dev/null | grep \<td\>| sed -n 3p|awk '{ gsub("[<td>\/]*[[:blank:]]*","");print}';
sleep 60;
done;
@efontan
efontan / Dockerfile.dev
Created May 30, 2020 21:06
Golang Dockerfile example
# Start from golang base image
FROM golang:1.13 as builder
# Install git.
# Git is required for fetching the dependencies.
RUN apk update && apk add --no-cache git
# Set the current working directory inside the container
WORKDIR /app
# Copy files