Skip to content

Instantly share code, notes, and snippets.

View httpmurilo's full-sized avatar
💭
I may be slow to respond.

Murilo httpmurilo

💭
I may be slow to respond.
View GitHub Profile
class Program
{
static void Main(string[] args)
{
while (true)
{
Console.WriteLine("Escolha uma opção:");
Console.WriteLine("1. A) Apresentar todos os valores numéricos inteiros ímpares situados na faixa de 0 a 40.");
Console.WriteLine("2. B) Apresentar o total da soma dos 100 primeiros números inteiros.");
@httpmurilo
httpmurilo / local.vendas.json
Created May 3, 2024 19:50
local.vendas.json
[{
"_id": {
"$oid": "663537143703c155de7cd0a7"
},
"NOME": "João",
"CLIENTE_VIP": 1,
"EMAIL": "joao@email.com",
"TELEFONE": [
"9999-1111",
"8888-1111"
'-'
' '
'&'
'^'
'*'
' or ''-'
' or '' '
' or ''&'
' or ''^'
' or ''*'
@httpmurilo
httpmurilo / Main.java
Last active April 3, 2024 01:28
easy-to-use sql injection with java
public class Main {
public static void main(String[] args) {
String fileName = "nomes.txt";
String baseUrl = "http://localhost:8080/api/user/search?name=";
try (BufferedReader br = new BufferedReader(new FileReader(fileName))) {
String line;
while ((line = br.readLine()) != null) {
String urlWithParam = baseUrl + line.trim();
System.out.println("Fazendo requisição para: " + urlWithParam);
@httpmurilo
httpmurilo / IUserRepository.java
Created April 2, 2024 22:37
IUserRepository.java
public interface IUserRepository extends JpaRepository<User, Integer> {
@Query(value = "SELECT * FROM User WHERE name = '?1'", nativeQuery = true)
User getUserByName(String name);
}
@httpmurilo
httpmurilo / IUserRepository.java
Created April 2, 2024 21:30
IUserRepository.java
public interface IUserRepository extends JpaRepository<User, Integer> {
@Query(value = "SELECT * FROM User WHERE name = ?1", nativeQuery = true)
User getUserByName(String name);
}
@httpmurilo
httpmurilo / IUserRepository.java
Created March 29, 2024 01:17
IUserRepository.java
public interface IUserRepository extends JpaRepository<User, Integer> {
@Query("select u from User u where u.name =:nome ")
User getUserByName(String nome);
}
@httpmurilo
httpmurilo / User.java
Created March 29, 2024 01:16
User.java
@Entity
public class User {
public User() {}
@Id
private int id;
private String name;
@Enumerated(EnumType.STRING)
private Status isActive;
@httpmurilo
httpmurilo / UserController.java
Created March 29, 2024 01:15
UserController.java
@RestController
@RequestMapping("/api/user")
public class UserController {
@Autowired
private IUserRepository repository;
@GetMapping(value = "/search")
public ResponseEntity<User> findByName(@RequestParam String name) {
var user = repository.getUserByName(name);
@httpmurilo
httpmurilo / BuildMaster.java
Created October 5, 2023 00:10
Cria builders de forma automatica
import static java.lang.String.format;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;