Skip to content

Instantly share code, notes, and snippets.

View eduzen's full-sized avatar
🎯
Focusing

Eduardo Enriquez eduzen

🎯
Focusing
View GitHub Profile
@eduzen
eduzen / psql_useful_stat_queries.sql
Created September 24, 2019 09:28 — forked from anvk/psql_useful_stat_queries.sql
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
@eduzen
eduzen / commit-msg
Created July 28, 2019 15:10
Add branch name with a hook: .git/hooks/commit-msg
#!/bin/sh
#
# Automatically adds branch name and branch description to every commit message.
#
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
TEXT=$(cat "$1" | sed '/^#.*/d')
if [ -n "$TEXT" ]
then
@eduzen
eduzen / merge_lists.py
Created July 7, 2019 17:13
Merge arrays with duplicated elements
def merge_lists(aList, bList):
if not aList or not bList:
print("empty lists")
return aList + bList
c = []
while aList and bList:
if aList[0] < bList[0]:
c.append(aList.pop(0))
else:
@eduzen
eduzen / docker-compose.yml
Created May 19, 2019 19:30
Openvpn corriendo en docker
version: '2'
services:
openvpn:
cap_add:
- NET_ADMIN
image: kylemanna/openvpn
container_name: openvpn
ports:
- "1194:1194/udp"
restart: always
@eduzen
eduzen / .env
Created May 19, 2019 18:36
django.env
SECRET_KEY=somesecret
NORECAPTCHA_SECRET_KEY=somekey
NORECAPTCHA_SITE_KEY=somekey
MAILGUN_API_KEY=somekey
MAILGUN_SENDER_DOMAIN=somekey
EMAIL_BACKEND=somekey
DEFAULT_FROM_EMAIL=somekey
ALLOWED_HOSTS=["*"]
VIRTUAL_HOSTS=someurl
INTERNAL_IPS=somekey
@eduzen
eduzen / docker-compose.yml
Created May 19, 2019 18:36
docker-compose for django app
version: '3'
volumes:
pgdata:
services:
web:
build: .
command: python manage.py runserver_plus 0.0.0.0:8000
volumes:
@eduzen
eduzen / Dockerfile
Created May 19, 2019 18:35
Dockerfile for django/python with multistage builds based on alpine
FROM python:3.7-alpine as base
ENV PYTHONDONTWRITEBYTECODE 1
COPY requirements.txt requirements_dev.txt ./
RUN apk add --update --no-cache --virtual .build-deps \
build-base \
postgresql-dev \
libffi-dev \
python3-dev \
@eduzen
eduzen / Dockerfile
Created May 19, 2019 18:33
Dockerfile for Django app with alpine
FROM python:3.7-alpine
COPY requirements.txt requirements_dev.txt ./
RUN apk add --update --no-cache --virtual .build-deps \
build-base \
postgresql-dev \
libffi-dev \
python3-dev \
libffi-dev \
@eduzen
eduzen / Dockerfile
Created May 19, 2019 18:30
Dockerfile for Python script based on debian image.
FROM python:3
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "./your-daemon-or-script.py" ]
@eduzen
eduzen / index.json
Last active September 29, 2018 21:34
elasticsearch
{
"_index": "credential",
"_type": "_doc",
"_id": "Credential_9515338",
"_score": 1,
"_source": {
"created_at": "2018-09-28T17:34:45.427081+00:00",
"reference_id": "CeZlKnimSC",
"email_domain": {
"domain": "bbva-continental-pe.securepe.net",