Skip to content

Instantly share code, notes, and snippets.

View wen-dell's full-sized avatar
🏠
Working from home (👍🏽)

Wendell Alves wen-dell

🏠
Working from home (👍🏽)
  • Parnamirim - RN, Brazil
View GitHub Profile
@wen-dell
wen-dell / README.md
Created February 14, 2019 12:42
Atualização do projeto

1 - O primeiro passo é enviar os projetos pro servidor. scp -r suap/ usuario@ip:~ Os ips podem ser 172.16.0.100 (homologação) e 172.16.0.103 (produção) 2 - Conecte-se ao servidor usando ssh. ssh usuario@ip 3 - Entre na pasta /var/opt/ se houver alguma coisa lá, envie para sua pasta home. sudo mv suap ~/suap_old/. 4 - Agora mova o suap mais atual da sua pasta home para /var/opt/. sudo mv ~/suap /var/opt/. 5 - Depois disso, altere o arquivo settings do projeto e mude as permissões de duas pastas. sudo chown -R www-data.www-data deploy/ e sudo chown -R www-data.www-data static/. 6 - Reinicie o gunicorn. sudo supervisorctl restart suap.

@wen-dell
wen-dell / plural.pipe.ts
Created February 7, 2018 01:31
Pluralizing words in Angular
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'plural'
})
export class PluralPipe implements PipeTransform {
transform(value: any, args?: any): any {
return value > 1 ? `${value} ${args}s` : `${value} ${args}`;
}
@wen-dell
wen-dell / persistence.xml
Created July 5, 2017 01:34
Arquivo de persistência
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="exemploPU" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/cadastro_cliente"/>
@wen-dell
wen-dell / index.html
Created February 11, 2017 20:00
Página principal
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="author" content="Wendell Alves"/>
<meta name="description" content="Página que mostra detalhes sobre o Bitcoin"/>
<meta http-equiv="refresh" content="300"/> <!-- Atualiza a cada 5 minutos -->
<title>Gráfico do Bitcoin</title>
</head>
<body>
@wen-dell
wen-dell / ClienteSocketArquivo.java
Last active December 29, 2016 02:09
Cliente que manda um arquivo pela rede e servidor que recebe este arquivo.
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.net.Socket;
import java.util.Scanner;
public class ClienteSocketArquivo {
public static void main(String[] args) throws IOException {
@wen-dell
wen-dell / Ponto.java
Last active December 10, 2016 18:59
Calcular distância entre dois pontos
public class Ponto {
public static double distancia(double x1, double y1, double x2, double y2){
return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
}
}
@wen-dell
wen-dell / Primo.java
Last active December 10, 2016 19:00
Verificar se é primo
public class Primo {
public static boolean isPrimo(int numero){
if(numero == 0 || numero == 1){
return false;
}
for(int i = 2; i < numero/2; i++){
if(numero % i == 0){