Skip to content

Instantly share code, notes, and snippets.

View isccarrasco's full-sized avatar
🏠
Working from home

Mario Jiménez Carrasco isccarrasco

🏠
Working from home
View GitHub Profile
@isccarrasco
isccarrasco / Ansible Let's Encrypt Nginx setup
Created October 18, 2023 02:26 — forked from mattiaslundberg/Ansible Let's Encrypt Nginx setup
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@isccarrasco
isccarrasco / M2M_Association_SQLalchemy.py
Created November 10, 2022 01:23 — forked from SuryaSankar/M2M_Association_SQLalchemy.py
An example of a many to many relation via Association Object in SQLAlchemy
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship, backref
from sqlalchemy.ext.associationproxy import association_proxy
import uuid
engine = sqlalchemy.create_engine('sqlite:///:memory:')
Base = declarative_base()
@isccarrasco
isccarrasco / flask-sqlite.py
Created November 8, 2022 23:37 — forked from asyd/flask-sqlite.py
Enforce FK constraint for SQLite with when using flask-sqlalchemy
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
def create_app(config: str=None):
app = Flask(__name__, instance_relative_config=True)
if config is None:
app.config.from_pyfile('dev.py')
else:
logger.debug('Using %s as configuration', config)
app.config.from_pyfile(config)
@isccarrasco
isccarrasco / wildfly-install.sh
Last active October 6, 2018 05:50 — forked from sukharevd/wildfly-install.sh
Script to install JBoss Wildfly 11.x as service in Linux
#!/bin/bash
#title :wildfly-install.sh
#description :The script to install Wildfly 10.x
#more :http://sukharevd.net/wildfly-8-installation.html
#author :Dmitriy Sukharev
#date :2015-10-24T17:14-0700
#usage :/bin/bash wildfly-install.sh
#tested-version :10.0.0.Final
#tested-distros :Debian 7,8; Ubuntu 15.10; CentOS 7; Fedora 22
@isccarrasco
isccarrasco / mdb2postgres.sh
Last active September 11, 2024 16:59 — forked from mutolisp/mdb2postgres.sh
Convert Microsoft Access *.mdb file into PostgreSQL database
#!/usr/bin/env bash
# install mdbtools first!
# mdbtools: https://github.com/brianb/mdbtools
# ref: https://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL
DBMS=postgres
for MDB in `ls | grep .mdb$`
@isccarrasco
isccarrasco / Update PostgreSQL on Mac
Last active August 29, 2015 14:22 — forked from joho/gist:3735740
Update PostgreSQL on Mac
### Steps to upgrade/install and run PostgreSQL 9.4.3 using Homebrew (Mac OS X)
(if you aren't using version 9.3.5_1, change line 6 with the correct version)
1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2. mv /usr/local/var/postgres /usr/local/var/postgres-9.3
3. brew update
4. brew upgrade postgresql
5. initdb /usr/local/var/postgres -E utf8
6. pg_upgrade -b /usr/local/Cellar/postgresql/9.3.5_1/bin -B /usr/local/Cellar/postgresql/9.4.3/bin -d /usr/local/var/postgres-9.3 -D /usr/local/var/postgres
@isccarrasco
isccarrasco / autopgsqlbackup.sh
Last active November 13, 2024 03:48 — forked from matthewlehner/autopgsqlbackup
Script to automate the postgresql database backups, this script can create backups for daily, weekly and monthly for an only database or all databases, also can create crontab task for backups using hours of backups.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9