Skip to content

Instantly share code, notes, and snippets.

View gamorales's full-sized avatar

Guillermo Alfonso Morales gamorales

  • Santiago de Cali, Valle del Cauca, Colombia
View GitHub Profile
@gamorales
gamorales / .bashrc
Last active June 13, 2022 12:48
.bashrc or .bash_profile configuration
alias android='/bin/sh /opt/android-studio/bin/studio.sh'
alias postman='cd /opt/postman/app;./Postman'
alias www='cd /var/www/html && clear && ls'
alias cdpython='cd ~/Documentos/desarrollo/python && clear && ls'
alias cddjango='cd ~/Documentos/desarrollo/python/django && clear && ls'
alias cdandroid='cd ~/Documentos/desarrollo/android && clear && ls'
alias cddocker='cd ~/Documentos/desarrollo/docker && clear && ls'
alias buildpython='make -j2 -s'
alias djangorun='python3 manage.py runserver'
alias djangoshell='python3 manage.py shell'
@gamorales
gamorales / check_odoo.py
Created March 4, 2020 12:07
Verifying if odoo (or any process) is running.
import subprocess
try:
resultado = subprocess.check_output("sudo systemctl status odoo12 | grep 'Active: failed'", shell=True)
if "Active: failed" in resultado:
subprocess.check_output("sudo systemctl stop odoo12", shell=True)
subprocess.check_output("sudo systemctl start odoo12", shell=True)
print("activado 1")
else:
resultado = subprocess.check_output("sudo systemctl status odoo12 | grep inactive", shell=True)
@gamorales
gamorales / anagram.py
Created February 27, 2020 18:50
Find if a word is an anagram of other.
import re
def anagram(a, b):
regex = f"^(?!.*(.).*\1)[{a}]*$"
if re.search(regex, b, flags=re.IGNORECASE):
return True
return False
@gamorales
gamorales / ci.yml
Last active January 1, 2022 04:05
Continous Integration github actions
name: Continous Integration
on:
pull_request:
branches:
- development
jobs:
build:
@gamorales
gamorales / settings.py
Created January 12, 2020 13:44
Run test with different database
import sys
import os
# ...
# settings.py extra configurations
# ...
if sys.argv[1] == 'test':
DATABASES = {
'default': {