Skip to content

Instantly share code, notes, and snippets.

View nelsoncbf's full-sized avatar
:octocat:

Nelson Fonseca nelsoncbf

:octocat:
View GitHub Profile
<?php
$hora = 123456;
$h = substr($hora, -6, 2); // retorna "f"
$m = substr($hora, -4, 2); // retorna "ef"
$s = substr($hora, -2); // retorna "d"
$hora2 =$h.$m.$s;
echo $hora2;
echo "<br>", $h, ("h "), $m,("m "), $s, ("s");
<?php
//Conversão de hora milessegundos para hora, minuto e segundos.
$contasegundos = floor($row['HORA']/1000);
$horas = floor($contasegundos / 3600);
$minutos = floor(($contasegundos - ($horas * 3600)) / 60);
$segundos = floor($contasegundos % 60);
$row['HORA'] = $horas."h ".$minutos."min ".$segundos."s";
//fim
?>
@nelsoncbf
nelsoncbf / config_production.txt
Last active January 23, 2019 12:13
Configuração de Ambiente Homologação
- Docker images para homologação
httpd 2.4.34
tomcat 9.0.12
- Puxando as imagens
docker run httpd:2.4.34
docker run tomcat:9.0.12
- Compactar pata .tar
docker save httpd:2.4.34 > http.tar
@nelsoncbf
nelsoncbf / vscode-produtividade
Created April 12, 2019 05:28
vscode-produtividade
//Function no JavaScript
function helloWorld() {
console.log("Hello World");
}
//Function no EcmaScript
const saudacao = () => {
const hora = new Date().getHours();
if (hora <= 12) return "Bom dia";
if (hora <= 18) return "Boa tarde";
@nelsoncbf
nelsoncbf / Documentação VENV.txt
Last active June 18, 2019 13:35
Documentação VENV
#VENV DOCUMENTAÇÃO
1: Instalando
$ sudo apt install python3-venv
2: Criar diretório do projeto
$ mkdir projeto && cd projeto
3: Criando ambiente venv dentro do projeto
$ python -m venv meuenv
@nelsoncbf
nelsoncbf / Comandos Django 2.2
Last active June 18, 2019 16:20
Comandos Django 2.2
1: Ver versão Django
$ python -m django --version
2: Criar projeto MySite
$ django-admin startproject mysite
3: Levantar servidor de desenvolvimento
$ python manage.py runserver (opcionl: 8000 ou 8080)
4: Criar App Polls
@nelsoncbf
nelsoncbf / environment
Created June 21, 2019 02:45
/etc/environment
# Androidsdk /etc/profile
export ANDROID=/opt/android
export PATH=$PATH:$ANDROID/tools
export PATH=$PATH:$ANDROID/tools/bin
export PATH=$PATH:$ANDROID/platform-tools
# Nodejs /etc/profile
VERSION=v10.16.0
DISTRO=linux-x64
export OPT_RAIZ=/opt
@nelsoncbf
nelsoncbf / index.html
Created August 1, 2019 02:44
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Ativador - MamboRouter</title>
</head>
<body>
<h1>Insira a hash para ativação</h1><br>
<p>
<b>Hash</b> <input type="text" placeholder="insira a hash aqui"><br>
@nelsoncbf
nelsoncbf / supervisor_client.py
Last active May 11, 2020 21:59 — forked from jalp/supervisor_client.py
Supervisor api client in Python
#import xmlrpclib
from xmlrpc import client
class ProcessStatus(object):
RUNNING = 'RUNNING'
STOPPED = 'STOPPED'
FATAL = 'FATAL'
RESTARTING = 'RESTARTING'
SHUTDOWN = 'SHUTDOWN'
pacientes_alergias = db.Table('pacientes_alergias',
db.Column('paciente_id', Integer, ForeignKey('paciente.id'), primary_key=True),
db.Column('alergias.id', Integer, ForeignKey('alergias.id'), primary_key=True)
)
pacientes_doencas = db.Table('pacientes_doencas',
db.Column('paciente_id', Integer, ForeignKey('paciente.id'), primary_key=True),
db.Column('doencas.id', Integer, ForeignKey('doencas.id'), primary_key=True)
)