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 / retrier.go
Created November 2, 2021 19:22
Golang simply retrier with exponential backoff
package retrier
import (
"time"
"github.com/pkg/errors"
)
type backoffRetrier struct {
initialDelay time.Duration
@efontan
efontan / search_in_csv.py
Created April 5, 2021 21:11
Search in CSV with Python
#!/usr/bin/python
import csv
# input text you want to search
text = input("Input to search: ")
with open("/path/to/my/file.csv", "r") as f:
csv_file = csv.reader(f, delimiter=",")
# iterate over the csv list
@efontan
efontan / move-wsl2.md
Last active March 13, 2021 09:14
Move WSL2 distro from C drive in Windows 10

Move WSL2 distro from C drive in Windows 10

choco install lxrunoffline
  • List installed distros:
wsl -l -v
 NAME STATE VERSION
@efontan
efontan / go.json
Created July 27, 2020 21:44
My VSCode Go snippets
{
"Service with constructor": {
"prefix": "service",
"body": [
"type $1 struct {",
"}\n",
"func New${1/(.*)/${1:/capitalize}/}() (*$1, error) {",
"\treturn &$1{}, nil",
"}",
],
@efontan
efontan / main.go
Created June 1, 2020 15:31
Clone repository with go-git using SSH Deploy Key
package main
import (
"fmt"
"log"
"os"
"strings"
"github.com/go-git/go-billy/v5/memfs"
gogit "github.com/go-git/go-git/v5"
@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
@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 / 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
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 / enable-paste-bookmark.html
Created March 17, 2019 19:05
Disable paste blockers on forms
javascript:void($('input').attr('onpaste', ''));