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 / 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 / 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 / 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
FROM python:3.8-buster
ENV PYTHONUNBUFFERED=1
RUN mkdir -p /src/app/
WORKDIR /src
ADD requirements.txt /src/requirements.txt
RUN pip install -r requirements.txt
@thinmy
thinmy / docker-compose.yml
Created December 7, 2020 11:43
Docker nginx proxy with letsencrypt companion
version: '3.2'
services:
nginx-proxy:
container_name: nginx-proxy
image: jwilder/nginx-proxy
environment:
- ENABLE_IPV6=true
ports:
- "80:80"
@thinmy
thinmy / django-settings.py
Created April 13, 2020 23:32 — forked from ilosamart/django-settings.py
Graylog2 (apache and nginx)
"""
... some code
"""
import socket
HOSTNAME=socket.gethostname()
"""
... some more code
@thinmy
thinmy / imap-search
Created June 28, 2019 00:11 — forked from martinrusev/imap-search
IMAP Search criteria
@thinmy
thinmy / gmail_imap_example.py
Created June 11, 2019 04:06 — forked from robulouski/gmail_imap_example.py
Very basic example of using Python and IMAP to iterate over emails in a gmail folder/label. http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#!/usr/bin/env python
#
# Very basic example of using Python and IMAP to iterate over emails in a
# gmail folder/label. This code is released into the public domain.
#
# RKI July 2013
# http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#
import sys
import imaplib
@thinmy
thinmy / install_python3.6.sh
Created October 9, 2018 11:02 — forked from rafpyprog/install_python3.6.sh
Script for install of Python 3.6 on Ubuntu
#!/bin/bash
add-apt-repository ppa:jonathonf/python-3.6 && apt-get update
apt-get install -y python3.6
@thinmy
thinmy / setup-u1804.sh
Created October 9, 2018 10:51
Setup dev environment using Ubuntu 18.04 MinimalCD, with Xubuntu Minimal DE, Node.js, Python, Golang, and more stuff.
#!/bin/sh
export USER=ndaidong
export GIT_NAME='Dong Nguyen'
export GIT_EMAIL='ndaidong@gmail.com'
export PYTHON_VERSION=3.6.5
export PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz