Skip to content

Instantly share code, notes, and snippets.

View ejdecena's full-sized avatar
▶️
Programming in Python all the time...

ᴇᴅɢᴀʀᴅ ᴅᴇᴄᴇɴᴀ ejdecena

▶️
Programming in Python all the time...
View GitHub Profile
@ejdecena
ejdecena / nodejs-cicd-github-actions.md
Created April 27, 2023 10:00 — forked from danielwetan/nodejs-cicd-github-actions.md
Deploy Node.js to VPS using Github Actions

Deploy Node.js to VPS using Github Actions

Steps to deploy Node.js to VPS using PM2 and Github Actions

1. Clone repo to VPS folder

@ejdecena
ejdecena / threadtrace.py
Created October 24, 2020 20:08
Thread Trace.
#!/usr/bin/env python3
# https://www.geeksforgeeks.org/python-different-ways-to-kill-a-thread/
import sys
import threading
class ThreadTrace(threading.Thread):
def __init__(self, *args, **keywords):
threading.Thread.__init__(self, *args, **keywords)
self.killed = False
@ejdecena
ejdecena / chronometer.py
Last active October 24, 2020 20:06
Threaded Chronometer.
#!/usr/bin/env python3
import time
import threading
class Chronometer:
def __init__(self):
self.clear()
def init(self):
@ejdecena
ejdecena / ciphertext.py
Created May 26, 2020 21:32
Class for text ciphering.
#!/usr/bin/env python3
import base64
class CipherText:
"""Class for text ciphering."""
KEY_SECRET = "123"
@staticmethod
def encrypt(original_text: str) -> str:
@ejdecena
ejdecena / sqlite_query_executor.py
Last active May 26, 2020 07:24
Execute a query in a SQLite-type database.
#!/usr/bin/env python3
import sqlite3
import typing
def execute_db_query(db_filename: str, query: str, parameters: tuple=()) \
-> typing.Any:
"""Execute a query in a SQLite-type database.
Args:
db_filename: string with the name of the SQLite file.
@ejdecena
ejdecena / singleton.py
Created May 24, 2020 21:57
Singleton decorator class.
#!/usr/bin/env python3
"""Singleton decorator class."""
class Singleton:
def __init__(self, cls):
self.__cls = cls
self.__obj = None
def __call__(self, *args, **kwargs):
if not self.__obj:
@ejdecena
ejdecena / vimrc
Created May 24, 2020 21:26
My .vimrc file for Vim.
"--------------------------
" .vimrc by Edgard Decena |
"--------------------------
set autowrite " Automáticamente guarda un archivo cuando se sale de un buffer.
set autoread " Automáticamente reload un archivo cuando ha sido modificado.
set number " Números de línea.
set cursorline " Línea del cursor.
set background=dark " Fondo oscuro.
set mouse=r " Mouse en xterm o GUI, apretando CTRL mientras se selecciona.
set t_Co=256