..TODO..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_bad_cfds(cfds): | |
invoice_types = ['Ingreso', 'Egreso'] | |
bad_cfds = [] | |
for cfd in cfds: | |
comprobante = {} | |
for invoice_type in invoice_types: | |
comprobante = cfd.metadata.get('IR', {}).get(invoice_type, {}).get('Comprobante') | |
if comprobante: | |
break | |
descuento = comprobante.get('Descuento', 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this snippet to the top of your playbook. | |
# It will install python2 if missing (but checks first so no expensive repeated apt updates) | |
# [email protected] | |
- hosts: all | |
gather_facts: False | |
tasks: | |
- name: install python 2 | |
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INTERNAL_NETWORK=192.168.1.0/24 | |
LAN=br-lan | |
LANIP=192.168.1.1 | |
SQUIDIP=192.168.1.10 | |
SQUIDPORT=3128 | |
iptables -t nat -A prerouting_rule -i $LAN ! -s $SQUIDIP -p tcp --dport 80 -j DNAT --to $SQUIDIP:$SQUIDPORT | |
iptables -t nat -A postrouting_rule -o $LAN -s $INTERNAL_NETWORK -d $SQUIDIP -j SNAT --to $LANIP | |
iptables -A forwarding_rule -s $INTERNAL_NETWORK -d $SQUIDIP -i $LAN -o $LAN -p tcp --dport $SQUIDPORT -j ACCEPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example configuration file for Services. After making the appropriate | |
# changes to this file, place it in the Services data directory (as | |
# specified in the "configure" script, default /home/username/services) | |
# under the name "services.conf". | |
# | |
# The format of this file is fairly simple: a line beginning with a # is a | |
# comment, and any other non-blank line is expected to be a directive and | |
# parameters, separated by spaces or tabs. For example: | |
# | |
# Directive Parameter-1 Parameter-2 ... |
I hereby claim:
- I am l4sh on github.
- I am l4sh (https://keybase.io/l4sh) on keybase.
- I have a public key ASB3P7m0PCWafpFCmR-zQA9vDGckrmWAUK7giET-LiFJMQo
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"model": "cfd.taxregime", "pk": "b2226b17-062f-4d3c-a831-9efe6455740f", "fields": {"metadata": {}, "private_metadata": {}, "created": "2017-09-25T22:49:33.118Z", "updated": "2017-09-28T16:20:13.374Z", "label": "general-de-ley-personas-morales", "description": "Aplica para tipo de persona Moral.", "name": "General de Ley Personas Morales", "key": "601"}}, {"model": "cfd.taxregime", "pk": "a0ac7a0d-7ce0-4d9e-8c45-2ba8c8b0e676", "fields": {"metadata": {}, "private_metadata": {}, "created": "2017-09-28T16:21:33.549Z", "updated": "2017-09-28T16:21:33.549Z", "label": "personas-morales-con-fines-no-lucrativos", "description": "", "name": "Personas Morales con Fines no Lucrativos", "key": "603"}}, {"model": "cfd.taxregime", "pk": "9fd6f984-4409-41d9-8f53-36d839b384df", "fields": {"metadata": {}, "private_metadata": {}, "created": "2017-09-28T16:22:37.187Z", "updated": "2017-09-28T16:22:37.187Z", "label": "sueldos-y-salarios-e-ingresos-asimilados-a-salarios", "description": "", "name": "Sueldos y Salarios e ingresos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from uuid import UUID | |
from django.core import serializers | |
from django.core.management.base import BaseCommand, CommandError | |
from django.apps import apps | |
class Command(BaseCommand): | |
help = 'Dumps the specified model data to stdout' |
NewerOlder