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].
# 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].
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) |
# Add this snippet to the top of your playbook. | |
# It will install python2 if missing (but checks first so no expensive repeated apt updates) | |
# gwillem@gmail.com | |
- hosts: all | |
gather_facts: False | |
tasks: | |
- name: install python 2 | |
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal) |
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 |
# 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:
To claim this, I am signing this object:
[{"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 |
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' |
#! /bin/bash | |
# Create and enable a temporary swap file | |
SWAPFILE="/tmp/swapfile1" | |
if [[ $1 == "on" ]] | |
then | |
echo Creating swap file on $SWAPFILE | |
dd if=/dev/zero of=$SWAPFILE bs=1024 count=524288 | |
mkswap $SWAPFILE |