Skip to content

Instantly share code, notes, and snippets.

View rinaldo-rex's full-sized avatar
🤔
In progress...

Rinaldo Rex rinaldo-rex

🤔
In progress...
View GitHub Profile
@rinaldo-rex
rinaldo-rex / macospython_error.md
Last active June 11, 2019 22:14
Valueerror on python for UTF-8 on macos
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

If you have faced the error on MacOS X, add these lines to ~/.bash_profile or for a temp fix, use env LANG=en_us.UTF-8 for a quickfix

@rinaldo-rex
rinaldo-rex / .editorconfig
Last active May 29, 2019 13:52
Editor config for python projects
# https://editorconfig.org/
# NOTE: This is the editor config of python's django project. :) Thanks to them.
root = true
[*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
@rinaldo-rex
rinaldo-rex / sphinx-documentation.md
Last active August 3, 2023 08:58
Sphinx documentation cheatsheet

Overview

This document is a simple resource to create sphinx documentation for projects with python(or not). This isn't exhaustive, but it'll help us get started without much hassle, (which, is typical for sphinx generated documenting)

Prerequisites

For better results, ensure that you're inside a virtual env. This document assumes you're in a Pipenv based environment. Update it later to include other python package management tools (hopefully poetry)

@rinaldo-rex
rinaldo-rex / celery_worker.py
Created June 11, 2019 09:29
Celery worker for application factory
"""The celery worker has to be started to handle the tasks of celery.
This pattern is followed because we're instantiating the flask application through
flask's application factory. The context of the application is required.
"""
from project import create_app # Flask application factory is used.
from project import celery # This is the celery instance that needs to be instantiated when a flask app is created.
import logging
logger = logging.getLogger('celery')
@rinaldo-rex
rinaldo-rex / system_utils.md
Last active August 28, 2019 06:24
Useful utilities that need to be configured on a new system!

System configurations/utilities that need to be installed on a new system for great productivity

  • ohmyzsh
    • I'm not yet a fan of Fish shell due to posix incompatibility which is causing a lot of troubles when you have to configure niche shell scripts.
  • howdoi - Get command line answers to common mac/linux problems.
  • thefuck - Alias it to automatically rewrite the command you wrongly entered.
  • z - Stop cding to dirs!
  • tmux - Once you start using this, it's hard to go back. This + Iterm is a heavenly combo
  • gitflow
@rinaldo-rex
rinaldo-rex / video_capture_save.py
Last active December 19, 2019 09:26
A simple script to record video via webcam and save to disk
# Thanks to http://tsaith.github.io/record-video-with-python-3-opencv-3-on-osx.html
import numpy as np
import cv2
cap = cv2.VideoCapture(0) # Capture video from camera
# Get the width and height of frame
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH) + 0.5)
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT) + 0.5)
@rinaldo-rex
rinaldo-rex / Transparent drawings in OpenCV.py
Created April 5, 2020 14:10 — forked from IAmSuyogJadhav/Transparent drawings in OpenCV.py
Add transparency to rectangles, circles, polgons, text or any shape drawn in OpenCV.
import cv2
image = cv2.imread('test.jpg')
overlay = image.copy()
x, y, w, h = 10, 10, 10, 10 # Rectangle parameters
cv2.rectangle(overlay, (x, y), (x+w, y+h), (0, 200, 0), -1) # A filled rectangle
alpha = 0.4 # Transparency factor.
@rinaldo-rex
rinaldo-rex / initial_config.md
Last active November 27, 2020 17:56
An initial droplet configuration for easier getting started

Initial configuration for getting started

This assumes that you're creating a simple Ubuntu droplet on digital ocean

Basic installs based on my current experience.

  1. OhMyZsh
    • Install Zsh first. sudo apt-get install zsh
    • Possibly install zshmarks (Equivalent to fish marks)
@rinaldo-rex
rinaldo-rex / css-tricks.md
Last active May 27, 2021 11:10
Frontend CSS tricks

Use the following to build functional usable inpage anchors

div-class-name {
  /* This is for a cleaner, and better positioning for the anchor tag */
  display: inline-block;
  padding-top: 100px;
  margin-top: -100px;
  height: 0;
 width: 0;
@rinaldo-rex
rinaldo-rex / xrandr-config.md
Last active August 4, 2021 02:19
Handling different DPI settings for different monitors.