Skip to content

Instantly share code, notes, and snippets.

View thinmy's full-sized avatar
🎯
Focusing

Thinmy Patrick Alves thinmy

🎯
Focusing
View GitHub Profile
@thinmy
thinmy / portainer-stack-nginx-proxy.yml
Last active March 1, 2022 18:22
Start Portainer in docker swarm with nginx-proxy with ssl support using nginx-proxy-acme-companion.
version: '3.2'
services:
agent:
image: portainer/agent:2.10.0
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes
networks:
- agent_network
@thinmy
thinmy / main.py
Created March 19, 2022 20:46
#codesnippetsdev merge two lists into a dictionary
keys_list = ['A', 'B', 'C']
values_list = ['blue', 'red', 'bold']
#There are 3 ways to convert these two lists into a dictionary
#1- Using Python's zip, dict functionz
dict_method_1 = dict(zip(keys_list, values_list))
#2- Using the zip function with dictionary comprehensions
dict_method_2 = {key:value for key, value in zip(keys_list, values_list)}
@thinmy
thinmy / SimpleVueServiceProvider.js
Created July 28, 2023 09:55 — forked from jmosul/SimpleVueServiceProvider.js
A simple (singleton) service provider for VueJS
class ServiceProvider {
constructor(services) {
this._services = services;
// use proxy to create a "magic getter" that will search the _services for a matching name
// then call "_makeOnce" to instantiate or return the singleton
return new Proxy(this, {
get: (provider, service) => {
service = service.charAt(0).toUpperCase() + service.slice(1);
@thinmy
thinmy / deskew.py
Created November 11, 2024 00:10 — forked from zabir-nabil/deskew.py
compute skew angle and deskew in python (opencv)
import numpy as np
import math
import cv2
def rotate_image(image, angle):
image_center = tuple(np.array(image.shape[1::-1]) / 2)
rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0)
result = cv2.warpAffine(image, rot_mat, image.shape[1::-1], flags=cv2.INTER_LINEAR)
return result