Skip to content

Instantly share code, notes, and snippets.

Avatar
⚛️
Microservices

Afonso Rodrigues afonsoaugusto

⚛️
Microservices
View GitHub Profile
View Install_gmaps_notebook.txt
#https://github.com/pbugnion/gmaps
#Ambiente Windows com Anaconda instalado:
#terminal
conda install -c conda-forge gmaps
jupyter nbextension enable --py widgetsnbextension --sys-prefix
conda update conda
ou
conda install -c conda-forge googlemaps
View TelegramBot.py
#sudo ap-get update
#sudo pip install python-telegram-bot --upgrade
#https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-Your-first-Bot
from sys import path
from configparser import ConfigParser
from telegram import ParseMode, Emoji
from telegram.ext import Updater, CommandHandler
from telegram.ext import MessageHandler, Filters
@afonsoaugusto
afonsoaugusto / plano_cartesiano.py
Created Jan 10, 2018
plano cartesiano em python com as opções de marcação do matplot lib
View plano_cartesiano.py
a = ['-','--','-.',':','.',',','o','v'
,'^','<','>','1','2','3','4','s','p'
,'*','h','H','+','x','D','d','|','_']
b = ['b' ,'g' ,'r' ,'c' ,'m' ,'y' ,'k' ,'w']
pp = []
for i in a:
for j in b:
pp.append(j+i)
@afonsoaugusto
afonsoaugusto / plano_cartesiano.py
Created Jan 10, 2018
plano cartesiano em python com as opções de marcação do matplot lib
View plano_cartesiano.py
a = ['-','--','-.',':','.',',','o','v'
,'^','<','>','1','2','3','4','s','p'
,'*','h','H','+','x','D','d','|','_']
b = ['b' ,'g' ,'r' ,'c' ,'m' ,'y' ,'k' ,'w']
pp = []
for i in a:
for j in b:
pp.append(j+i)
View enable_query_log_mysql.sql
20 CONFIGURAR LOGS DE PROFILING
EXECUTAR SET GLOBAL GENERAL_LOG_FILE = '/PATH/FILENAME1' ;
EXECUTAR SET GLOBAL LONG_QUERY_TIME = 0.2;
EXECUTAR SET GLOBAL SLOW_QUERY_LOG_FILE = '/PATH/FILENAME2';
30 LIGAR COLETA DE SLOW QUERIES
EXECUTAR SET GLOBAL SLOW_QUERY_LOG = 'ON';
40 DESLIGAR COLETA DE SLOW_QUERIES
EXECUTAR SET GLOBAL SLOW_QUERY_LOG = 'OFF';
View enable_security_mongo.js
use admin
db.createUser(
{
user: "alice",
pwd: "secret",
roles: [ { role: "root", db: "admin" } ]
}
)
sudo mongod --auth --port 27017 --dbpath=/var/lib/mongodb
@afonsoaugusto
afonsoaugusto / setup_php.sh
Last active Jan 23, 2018
Setup enviroment ubuntu (nodejs, mysql 5.7, php7)
View setup_php.sh
#update do sistema
sudo apt-get update -y
sudo apt-get install -y build-essential
sudo apt-get install -y dialog
export DEBIAN_FRONTEND=noninteractive
#install node
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
#install react
View example_ST_Distance_Sphere.sql
mysql> SET @Casa = ST_GeomFromText('POINT(-19.758839 -43.939613)');
Query OK, 0 rows affected (0,00 sec)
mysql> SET @Praca = ST_GeomFromText('POINT(-19.7582095 -43.938092)');
Query OK, 0 rows affected (0,00 sec)
mysql> SELECT round(ST_Distance_Sphere(@Casa, @Praca),2);
+--------------------------------------------+
| round(ST_Distance_Sphere(@Casa, @Praca),2) |
+--------------------------------------------+
View cerate_column_point_mysql.sql
CREATE TABLE points (pt POINT);
SET @intptlon10 = ST_GeomFromText('POINT(-19.758839 -43.939613)');
SET @intptlat10 = ST_GeomFromText('POINT(-19.758839 -43.939613)');
insert into points values (@intptlon10);
insert into points values (@intptlat10);
mysql> SELECT ST_AsText(pt) FROM points;
+------------------------------+
| ST_AsText(pt) |
+------------------------------+
View create_spatial_index_mysql.sql
-- Inclusão no CREATE TABLE:
CREATE TABLE point_example (p POINT NOT NULL, SPATIAL INDEX(p));
-- Inclusão com ALTER TABLE:
drop table point_example;
CREATE TABLE point_example (p POINT NOT NULL);
ALTER TABLE point_example ADD SPATIAL INDEX(p);
--com CREATE INDEX:
drop table point_example;
You can’t perform that action at this time.