Skip to content

Instantly share code, notes, and snippets.

View evervasquez's full-sized avatar

EveR Vásquez evervasquez

View GitHub Profile
@evervasquez
evervasquez / make_ssl.md
Last active April 24, 2019 06:33
Generar ssl

Pasos para renovar certificados ssl

  1. Parar todos los procesos qu esten usando el puerto 80
$ sudo fuser -k 80/tcp 
  1. Generar el certificado
@evervasquez
evervasquez / README.md
Created April 12, 2019 15:08 — forked from valyala/README.md
Optimizing postgresql table for more than 100K inserts per second

Optimizing postgresql table for more than 100K inserts per second

  • Create UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.
  • Set WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we never DELETE or UPDATE the table).
  • Insert rows with COPY FROM STDIN. This is the fastest possible approach to insert rows into table.
  • Minimize the number of indexes in the table, since they slow down inserts. Usually an index on time timestamp with time zone is enough.
  • Add synchronous_commit = off to postgresql.conf.
  • Use table inheritance for fast removal of old data:
@evervasquez
evervasquez / mail.py
Created November 30, 2018 02:26 — forked from niran/mail.py
Multiple email connections in Django
from django.conf import settings
import django.core.mail
class MissingConnectionException(Exception):
pass
def get_connection(label=None, **kwargs):
if label is None:
label = getattr(settings, 'EMAIL_CONNECTION_DEFAULT', None)
@evervasquez
evervasquez / server_ssl
Created September 27, 2018 11:56
Server SSL
upstream negosy_app_server {
server unix:/home/negosy/run/gunicorn.sock fail_timeout=12;
}
server {
listen 80;
server_name www.app.negosy.com;
return 301 https://app.negosy.com$request_uri;
}
<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"
xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ext:UBLExtensions>
@evervasquez
evervasquez / nginx.conf
Created September 6, 2018 06:16 — forked from ashleydw/nginx.conf
Laravel nginx conf file
server {
listen 80 default_server;
server_name example.com www.example.com;
access_log /srv/www/example.com/logs/access.log;
error_log /srv/www/example.com/logs/error.log;
root /srv/www/example.com/public;
index index.php index.html;
@evervasquez
evervasquez / Boleta.xml
Created May 16, 2018 04:32 — forked from giansalex/Boleta.xml
Comprobantes Facturacion Electronica SUNAT UBL 2.1 (Factura, Boleta, Nota de Crédito, Nota de Débito)
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ext:UBLExtensions>
<ext:UBLExtension>
<ext:ExtensionContent>
</ext:ExtensionContent>
</ext:UBLExtension>
</ext:UBLExtensions>
<cbc:UBLVersionID>2.1</cbc:UBLVersionID>
<cbc:CustomizationID>2.0</cbc:CustomizationID>
@evervasquez
evervasquez / password_update.sh
Last active May 15, 2018 03:20
Update Password user in Postgres
# su - postgres
$ psql
# psql -U postgres -h localhost
psql (9.2.23)
Type "help" for help.
# ALTER USER postgres with password 'new_password';
# \q
exit
@evervasquez
evervasquez / change.sh
Created May 12, 2018 21:05
Change timezone in Debian 9/8
# reference:
# https://www.itzgeek.com/how-tos/linux/debian/how-to-change-timezone-in-debian-9-8-ubuntu-16-04-14-04-linuxmint-18.html
# Check the current time zone using the date command.
$ date
$ unlink /etc/localtime
$ ln -s /usr/share/zoneinfo/America/Lima /etc/localtime
@evervasquez
evervasquez / letsencrypt.md
Last active July 29, 2018 03:16
Create Wildcard LetsEncrypt