Skip to content

Instantly share code, notes, and snippets.

View alejandro-du's full-sized avatar
🦭
MariaDB 🤩

Alejandro Duarte alejandro-du

🦭
MariaDB 🤩
View GitHub Profile
############################################################################################
# 1. Create the operational table (users) and the cache table (users_session_cache).
# Make sure that the cache table uses MariaDB's MEMORY storage engine.
############################################################################################
CREATE OR REPLACE TABLE users(
id SERIAL PRIMARY KEY,
name VARCHAR(50) NOT NULL UNIQUE,
session_id VARCHAR(50)
) ENGINE=InnoDB;
@alejandro-du
alejandro-du / docker-compose.yml
Created January 22, 2024 11:49
Docker-based Development Environment with MariaDB + VS Code + Cloud Beaver
version: '3.8'
services:
mariadb-server:
image: mariadb:latest
hostname: mariadb-server
environment:
MARIADB_ROOT_PASSWORD: RootPassword123!
EDITOR: mcedit
command: >
@alejandro-du
alejandro-du / test_data_insert.py
Last active January 15, 2024 23:20
Insert demo data in batches into MariaDB databases using Python
import random
import os
import subprocess
from datetime import datetime, timedelta
# Function to generate a random date within a given range
def random_date(start, end):
return start + timedelta(days=random.randint(0, int((end - start).days)))
# Function to execute a given SQL command using MariaDB
@alejandro-du
alejandro-du / install-mariadb-with-columnstore-redhat-linux.sh
Created December 14, 2023 14:39
MariaDB Server (with added ColumnStore) installation on Red Hat Enterprise Linux
# Set up the MariaDB repository for version 11.1 to ensure the system uses the correct version and receives updates from the official source.
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=11.1
# Install the necessary MariaDB packages along with ColumnStore for fast and scalable analytics and CMAPI for managing ColumnStore nodes.
sudo dnf -y install MariaDB MariaDB-columnstore-engine MariaDB-columnstore-cmapi
# Automatically start MariaDB and its ColumnStore storage engine when the system boots, ensuring database availability after restarts.
sudo systemctl enable mariadb
sudo systemctl enable mariadb-columnstore-cmapi
@alejandro-du
alejandro-du / docker-compose.yml
Created September 15, 2023 10:17
Single MariaDB Community server with NoSQL support
version: "3.9"
services:
mariadb-community:
image: alejandrodu/mariadb
environment:
- MARIADB_CREATE_DATABASE=demo
- MARIADB_CREATE_USER=user:Password123!
- MARIADB_CREATE_MAXSCALE_USER=maxscale_user:MaxScalePassword123!
maxscale:
@alejandro-du
alejandro-du / armbian-setup.sh
Created December 12, 2022 13:49
A script that configures a Wi-Fi connection with static IP on Armbian for headless setups
#!/bin/bash
# find the mount point with sudo fdisk -l
mount /dev/mmcblk0p1 /media/sdcard/
rm /media/sdcard/boot/armbian_first_run.txt.template
touch /media/sdcard/boot/armbian_first_run.txt
echo "FR_general_delete_this_file_after_completion=1" >> /media/sdcard/boot/armbian_first_run.txt
echo "FR_net_change_defaults=1" >> /media/sdcard/boot/armbian_first_run.txt
@alejandro-du
alejandro-du / ApplicationTests.java
Created April 20, 2022 13:53
Prints the transaction isolation level used by Hibernate in a Spring Boot application
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ApplicationTests {
@alejandro-du
alejandro-du / Thread Group.jmx
Created February 3, 2021 19:25
Simple JMeter test plan for Vaadin 14 applications
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.1">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>

Workshop sobre Vaadin en Español

Comentario.java

package com.example.backend;

import java.time.LocalDateTime;
import java.util.Objects;
@alejandro-du
alejandro-du / custom-vaadin-combo-box-background-color.md
Created October 30, 2018 09:59
Customizing the background of a ComboBox component in Vaadin Flow apps
ComboBox<Object> comboBox = new ComboBox<>();
comboBox.addClassName("red-combo-box");
<dom-module id="custom-combo-box-styles" theme-for="vaadin-combo-box">
    <template>
        <style>
 :host(.red-combo-box) [part="text-field"] {