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 / 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
@thinmy
thinmy / create_swap.sh
Created October 9, 2018 10:51
Create swap
#!/bin/sh
export SWAP_SIZE=2G
sudo fallocate -l $SWAP_SIZE /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo bash -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab'
@thinmy
thinmy / install-node.sh
Created October 9, 2018 10:50 — forked from ndaidong/install-node.sh
Install Node 8.10.0 in Ubuntu 16+
#!/bin/bash
export NODE_VERSION=8.10.0
export NODE_DOWNLOAD_URL=https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.gz
wget "$NODE_DOWNLOAD_URL" -O node.tar.gz
tar -zxvf node.tar.gz
cd node-v$NODE_VERSION
./configure
make
sudo make install
@thinmy
thinmy / install-python.sh
Created October 9, 2018 10:50
Install Python 3.6.5 in Ubuntu 16+
#!/bin/bash
export PYTHON_VERSION=3.6.5
export PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz
sudo apt update
sudo apt install --no-install-recommends -y \
software-properties-common build-essential \
libssl-dev libreadline-dev libbz2-dev libsqlite3-dev zlib1g-dev \
python-minimal
@thinmy
thinmy / websockets-server.js
Created October 9, 2018 10:50
Pure Node.js WebSockets server
/*
* node-ws - pure Javascript WebSockets server
* Copyright Bradley Wright <brad@intranation.com>
*/
// Use strict compilation rules - we're not animals
'use strict';
var net = require('net'),
crypto = require('crypto');