Skip to content

Instantly share code, notes, and snippets.

@steppat
steppat / persistence.xml
Created Sep 28, 2020
persistence.xml inicial do curso JPA
View persistence.xml
<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_2_0.xsd"
version="2.0">
<persistence-unit name="contas">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>br.com.alura.jpa.modelo.Conta</class>
@steppat
steppat / pom.xml
Created Sep 28, 2020
pom.xml inicial do curso JPA
View pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.alura.jpa</groupId>
<artifactId>projeto-jpa</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
View bd.sql
CREATE TABLE ator
(
id_ator SERIAL PRIMARY KEY,
primeiro_nome VARCHAR(45) NOT NULL,
ultimo_nome VARCHAR(45) NOT NULL,
data_atualizado TIMESTAMP NOT NULL DEFAULT 'NOW()'
);
CREATE INDEX idx_ultimo_nome ON ator USING btree (ultimo_nome);
CREATE TABLE idioma
View LeilaoSteps.java
public class LeilaoSteps implements io.cucumber.java8.Pt{
private LoginPage loginPage;
private LeiloesPage leiloesPage;
private NovoLeilaoPage novoLeilaoPage;
private Browser browser;
public LeilaoSteps() {
Dado("um usuario logado", () -> {
this.browser = new Browser();
View fix-file-watcher.sh
!/bin/sh
echo fs.inotify.max_user_instances=524288 | tee -a /etc/sysctl.conf && sysctl -p
echo 999 | tee -a /proc/sys/fs/inotify/max_user_instances
echo 99999 | tee -a /proc/sys/fs/inotify/max_queued_events
echo 99999 | tee -a /proc/sys/fs/inotify/max_user_watches
View gist:dcbbb828efaec152e9bbe460ab2d2634
<?php
echo "Testando conexao <br /> <br />";
$servername = "192.168.1.24";
$username = "phpuser";
$password = "pass";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
@steppat
steppat / phpweb.pp
Created Feb 22, 2019
Simple Puppet Manifest PHP Installation Script
View phpweb.pp
# execute 'apt-get update'
exec { 'apt-update': # exec resource named 'apt-update'
command => '/usr/bin/apt-get update' # command this resource will run
}
package { ['php7.2' ,'php7.2-mysql'] :
require => Exec['apt-update'],
ensure => installed,
}
View create-db.sql
-- mysql -u root < create-db.sql
-- MySQL dump 10.13 Distrib 5.5.59, for debian-linux-gnu (x86_64)
--
-- Host: localhost Database: classloader
-- ------------------------------------------------------
-- Server version 5.5.59-0ubuntu0.14.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
View seguranca.md

Exercícios: Segurança

Nesse exercício vamos analisar um projeto com algumas falhas de segurança.

  1. Acesse o diretório Desktop/cursos/91/fj-91-exercicios e extraia o conteúdo do arquivo seguranca.zip em seu Desktop.

  2. Importe o projeto seguranca no seu Eclipse.

  3. Esse projeto utiliza o Spring Boot. Para executá-lo, basta rodar a classe Boot.java escolhendo a opção: Run As -> Java Application. O Hibernate se encarregará de criar o banco de dados e as tabelas utilizadas pela aplicação.

@steppat
steppat / Conta.java
Created Sep 25, 2017
pequeno exemplo de uma class que representa um Conta
View Conta.java
class Conta {
//atributos
private int numero;
private String titular;
private double saldo;
private double limite;
//construtor
Conta(int numero, String titular, double saldo, double limite) {