This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pydantic | |
import peewee | |
from playhouse.db_url import connect | |
from typing import List | |
import logging | |
logger = logging.getLogger('peewee') | |
logger.addHandler(logging.StreamHandler()) | |
logger.setLevel(logging.DEBUG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
CLIENT_INFO, | |
STATUS, -- Status da sessão (ex. ativa ou inativa) | |
S.SID, -- ID da sessão | |
S.SERIAL#, -- ID da operação | |
TO_CHAR(S.LOGON_TIME,'dd/mm/yyyy hh24:mi') START_TIME, -- Timestamp de início | |
S.USERNAME, -- Usuário da sessão | |
S.PROGRAM, -- Programa | |
S.MACHINE, -- Host de onde foi feita a conexão | |
SQ.SQL_TEXT, -- Consulta SQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import http.server | |
import sys | |
import socketserver | |
import os | |
class HTTPRequestHandler(http.server.SimpleHTTPRequestHandler): | |
def __init__(self,req, client_addr, server): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```shell | |
[✓] Root user check | |
.;;,. | |
.ccccc:,. | |
:cccclll:. ..,, | |
:ccccclll. ;ooodc | |
'ccll:;ll .oooodc | |
.;cll.;;looo:. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Upstreams | |
upstream backend { | |
server 127.0.0.1:3000; | |
} | |
# HTTPS Server | |
server { | |
listen 443; | |
server_name your_hostname.com; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Rocket.Chat Server | |
Requires=After=mongod.service # Requires the mongod service to run first | |
[Service] | |
ExecStart=/usr/local/bin/node /opt/rocket.chat/main.js | |
WorkingDirectory=/opt/rocket.chat # Set to rocket.chat directory | |
Restart=always | |
# Restart service after 10 seconds if node service crashes | |
RestartSec=10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hits = np.asarray([cnf_matrix[i][i] for i in range(cnf_matrix.shape[0])]) | |
expected = np.sum(cnf_matrix, axis=0) | |
num_hits = np.sum(hits) | |
total = test_data.shape[0] | |
precision = 100 * (num_hits / total) | |
recall_per_class = hits / expected | |
recall = 100 * (np.sum(recall_per_class) / recall_per_class.shape[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.metrics import confusion_matrix | |
cnf_matrix = confusion_matrix(test_data_labels, prediction) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
classifier = KNearestNeighbors(k=5) | |
# Train the classifier | |
classifier.fit(train_data, train_data_labels) | |
# Obtain the predictions based on the training data | |
prediction = classifier.predict(test_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.datasets import load_digits | |
import matplotlib.pyplot as plt | |
# Load data set and corresponding labels | |
digits_data = load_digits() | |
digits = digits_data.data | |
labels = digits_data.target | |
class_names = digits_data.target_names | |
# Partition data set into training and test data sets |
NewerOlder