Skip to content

Instantly share code, notes, and snippets.

@urodoz
urodoz / countrycodes.yml
Created November 17, 2013 12:11
List of country iso codes ISO 3166-1 (alpha-2) translated to English, Spanish, Catalonian, French and German
#
# List of country codes and country ens.
#
# Data taken from: http://openconcept.ca/blog/mgifford/text_list_all_countries
#
countries:
AF:
en: "Afghanistan"
es: "Afganistán"
fr: "Afghanistan"
@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 / _box_shadow.scss
Created July 29, 2016 07:22
Material Box Shadow SASS Mixin
@mixin box_shadow ($level) {
@if $level == 1 {
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
} @else if $level == 2 {
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
} @else if $level == 3 {
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
} @else if $level == 4 {
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
-- JSONB to text array
CREATE OR REPLACE FUNCTION jsonb_arr2text_arr(_js jsonb)
RETURNS text[] AS
$func$
SELECT ARRAY(SELECT jsonb_array_elements_text(_js))
$func$
LANGUAGE sql IMMUTABLE;
-- JSONB to int array
CREATE OR REPLACE FUNCTION jsonb_arr2int_arr(_js jsonb)
@urodoz
urodoz / filter.py
Created September 25, 2016 13:47
Django Null/Not null admin filter
from django.contrib.admin import SimpleListFilter
class NullListFilter(SimpleListFilter):
def lookups(self, request, model_admin):
return (
('1', 'Null',),
('0', '!= Null',),
)
@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 / 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
@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 / 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 / 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;
}