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 / keybase.md
Created December 18, 2023 17:47
Keybase

Keybase proof

I hereby claim:

  • I am isccarrasco on github.
  • I am isccarrasco (https://keybase.io/isccarrasco) on keybase.
  • I have a public key ASDnry8snDgvMSlrqP8-TgRFhlS_mzkx2_dknPedO-_cdAo

To claim this, I am signing this object:

@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)
# To install the plugin manager, run this:
# Neovim (~/.local/share/nvim/site/autoload)
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# Then configure the init.vim file
:set number
:set relativenumber
:set autoindent
@isccarrasco
isccarrasco / municipality_adjacency.py
Last active April 28, 2020 07:22
Looking for adjacency municipalities.
import geopandas as gpd
df = gpd.read_file('municipalities.shp')
df["adjacents"] = None
for index, municipality in df.iterrows():
# get 'not disjoint' countries
# CVE_ENT is the ID of the Municipality
adjacents = df[~df.geometry.disjoint(municipality.geometry)].CVE_ENT.tolist()
@isccarrasco
isccarrasco / virtualbox-kernel-headers.md
Last active March 25, 2022 17:27
Install kernel headers con CentOS 7 for VirtualBox

For Ubuntu

  1. sudo dpkg -l | grep -E "dkms|linux-headers-$(uname -r)|build-essential"
  2. apt install dkms build-essential
  3. sudo apt install dkms linux-headers-$(uname -r) build-essential

Review the list of kernels currently installed.

$ cd /usr/src/kernels/

@isccarrasco
isccarrasco / generate_data_model.md
Created November 8, 2016 06:52
Requirements for generate the Data Model from a PostgreSQL database
@isccarrasco
isccarrasco / find_duplicate_rows.sql
Created June 23, 2016 16:34
Find duplicate rows with PostgreSQL
select * from (
SELECT id,
ROW_NUMBER() OVER(PARTITION BY merchant_Id, url ORDER BY id asc) AS Row
FROM Photos
) dups
where
dups.Row > 1
@isccarrasco
isccarrasco / reinstall_mac.md
Last active July 20, 2023 23:47
Reinstallation of Mac

Configure MacBook Pro for work

This gist was created based on this web page.

  1. Download Xcode by executing xcode-select --install and select Get Xcode option.

  2. Install the standalone Command Line Tools by executing xcode-select --install and select Install option.

  3. Install Homebrew by executing the next command.