Skip to content

Instantly share code, notes, and snippets.

@urodoz
urodoz / haproxy.cfg
Created April 14, 2017 21:45
Multiple SSL certificates in HAProxy configuration
global
maxconn 2048
defaults
mode http
timeout connect 5000ms
timeout client 90000ms
timeout server 90000ms
frontend secure-http-in
@urodoz
urodoz / clean_docker.sh
Last active September 12, 2022 18:17
Cleans the old images and exited containers
# Clean the exited containers
docker rm $(sudo docker ps -a | grep Exit | cut -d ' ' -f 1)
# Clean the untagged images (or old images)
docker rmi $(docker images | tail -n +2 | awk '$1 == "<none>" {print $'3'}')
# On Docker 1.9+ you can remove the orphan volumes with the next command
docker volume rm $(docker volume ls -qf dangling=true)
@urodoz
urodoz / excel_parser.py
Last active May 26, 2019 14:07
Convert Excel file to list of dicts with headers as key name for each value with pyopenxl
from xlrd import open_workbook
class ExcelParser(object):
def excel_to_list(self, file_path):
wb = open_workbook(file_path)
rows = []
for sheet in wb.sheets():
@urodoz
urodoz / extract_emails.sh
Last active September 25, 2017 07:19
Bash script to extract emails from file
#!/bin/bash
#Usage: bash extract_emails.sh file.txt output.txt
perl -ne'if(/[\w\.\-\_]+@([\w\-\_]+\.)+[A-Za-z]{2,4}/g){print "$&\n"}' $1 | sort | uniq > $2
@urodoz
urodoz / .bashrc
Created July 13, 2017 18:01
Fast find file function with filter
# Search on the current directory a matching file
# Find all files containing the args
# Usage: ff sample
function ff() {
find . -print |grep -i "$@"
}
@urodoz
urodoz / .bashrc
Created July 13, 2017 14:51
Set of useful Git alias and functions to increase productivity
alias gfo='git fetch origin'
alias gs='git status -sb'
# Automatically generates the bump commit and tags
# Usage: bump 1.0.4
function bump() {
echo "-- [$1] Bump commit"
git commit -am"Bump to $1"
echo "-- [$1] Tagging
git tag $1
@urodoz
urodoz / ellipsis.css
Created July 13, 2017 14:40
CSS Ellipsis
/* Applies ellipsis to the text container */
.text-elipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@urodoz
urodoz / ctags.sh
Created June 12, 2017 08:41
ctags for js project
ctags -R \
--exclude=.git \
--exclude=src/node_modules/* \
--exclude=node_modules/* \
--exclude=src/bower_components/* \
--exclude=app/*
# Javascript tags
find ./src/app -type f -iregex ".*\.js$" \
-not -path "./node_modules/*,./src/node_modules/*,./src/bower_components/*" \
@urodoz
urodoz / Dockerfile
Created April 15, 2017 09:41
Circus in Dockerfile
FROM node:7.9.0
MAINTAINER Albert Lacarta <albert.lacarta@rqlogic.com>
RUN npm install -g bower@1.8.0 && \
npm install -g node-sass && \
npm install -g http-server && \
npm install -g gulp-cli
# Install circus to handle processes
RUN apt-get update && apt-get install -y python-pip python python-dev
@urodoz
urodoz / Dockerfile
Created April 15, 2017 07:36
Dockerfile with self signed SSL Certificate
FROM python:2.7.13
MAINTAINER Albert Lacarta <urodoz@gmail.com>
ADD requirements.txt /opt/requirements.txt
RUN pip install -r /opt/requirements.txt
RUN mkdir -p /opt/code
WORKDIR /opt/code
ADD supervisord.conf /etc/supervisord.conf
CMD supervisord -c /etc/supervisord.conf