Skip to content

Instantly share code, notes, and snippets.

@AlbertProfe
AlbertProfe / hilla-car.md
Last active April 24, 2025 10:30
Hilla minimum carRenting

Hilla minimum carRenting

Let's save the car JSON straightforwardly to DynamoDB by directly mapping the JSON to a Map<String, AttributeValue> item and using the AWS SDK Java v2 PutItem operation.

Car JSON Example:

{
  "id": "123",
  "make": "Toyota",

Create local and remote repo from everywhere

Previously

  • We need to set up permissions to access GitHub.
  • Installed git and gh.

Bash create-repo

Here is the script we are going to use:

package com.example.userBorrowBook;
import com.example.userBorrowBook.model.Book;
import com.example.userBorrowBook.model.Borrow;
import com.example.userBorrowBook.model.UserApp;
import com.example.userBorrowBook.repository.BookRepository;
import com.example.userBorrowBook.repository.BorrowRepository;
import com.example.userBorrowBook.repository.UserAppRepository;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@AlbertProfe
AlbertProfe / py-requesats.py
Created January 31, 2025 10:41
Python test Spring Boot endpoints
#!/usr/bin/env python3
import requests
base_url = "http://localhost:8080/api/words"
# CREATE (POST)
def create_word(word):
response = requests.post(base_url, json={"word": word})
print(f"Create Word: {response.status_code}")
@AlbertProfe
AlbertProfe / create-git-pra-branch.sh
Last active November 8, 2024 12:31
Create local/remote repo test
#!/bin/bash
# Function to log operations
log_operation() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1"
}
# Function to log operations
log_operation() {
@AlbertProfe
AlbertProfe / help.md
Last active October 30, 2024 12:16
simplify-boot

Spring Boot sources to text

This Bash script is designed to analyze and document the contents of a Spring Boot project. Here's a summary of what the script does:

  1. User Input:

    • Prompts the user to enter the path to their Spring Boot project.
    • Validates if the specified directory exists.
  2. Project Analysis:

  • Extracts the project name from the path.
@AlbertProfe
AlbertProfe / Step-by-step.md
Last active October 30, 2024 12:31
Pipeline github dropbox

BackUp GitHub repo to Dropbox

Here's the step-by-step tutorial with the instructions to implement the feature:

To use this script:

1. Replace the placeholder values in the script:
   - `GITHUB_USER`: Your GitHub username
   - `REPO_NAME`: The repository name
@AlbertProfe
AlbertProfe / authomate.md
Created October 18, 2024 09:09
Authomate Sync to Local

Authomate Sync to Local

Approach

To sync your forked repository (AlbertProton/restaurant) with the original repository (AlbertProfe/restaurant) using the GitHub CLI (gh) and then pull the changes to your local clone, follow these steps:

  1. Sync the fork using gh repo sync:
gh repo sync AlbertProton/restaurant --source AlbertProfe/restaurant
@AlbertProfe
AlbertProfe / CarExample.java
Created September 20, 2024 11:20
How to iterate key-valu of a HashMap
import java.util.HashMap;
import java.util.Map;
public class CarExample {
public static void main(String[] args) {
// Create a HashMap of cars
Map<String, Car> cars = new HashMap<>();
cars.put("ABC123", new Car("Toyota", "Corolla"));
cars.put("XYZ789", new Car("Honda", "Civic"));
cars.put("DEF456", new Car("Ford", "Mustang"));