you know what a spinlock is, right?
here's a spinlock:
async def create_charge(charge: Charge, customer: Customer) -> None: | |
if not customer.is_active(): | |
raise Customer InactiveError("The customer is not active.") | |
if not charge.has_valid_amount(): | |
raise InvalidChargeAmountError("The charge amount must be greater than zero.") | |
if not charge.has_valid_due_date(): | |
raise InvalidDueDateError("The due date must be in the future.") |
import org.assertj.core.groups.Tuple; | |
import org.junit.jupiter.api.DisplayName; | |
import org.junit.jupiter.api.Test; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration; | |
import org.springframework.boot.test.context.SpringBootTest; | |
import org.springframework.test.context.ActiveProfiles; | |
import jakarta.validation.ConstraintViolation; | |
import jakarta.validation.Validator; |
# Brilliant one-liner | |
(echo "PID COMMAND PORT USER"; lsof -i -P -n | grep LISTEN | awk '{print $2, $1, $9, $3}' | sort -u | head -n 50; echo;) \ | |
| column -t \ | |
| llm "what servers are running on my machine and do some of them look like they could be orphaned things I can shut down" | |
# Maybe even more brilliant one liner | |
(echo "PID COMMAND PORT USER"; lsof -i -P -n | grep LISTEN | awk '{print $2, $1, $9, $3}' | sort -u | head -n 50) \ |
package base; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import java.io.File; | |
import java.io.FileWriter; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; |
package br.com.rponte.sample.ssh; | |
import com.jcraft.jsch.ChannelExec; | |
import com.jcraft.jsch.JSch; | |
import com.jcraft.jsch.Session; | |
import java.io.BufferedReader; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.nio.file.Path; |
-- (This code was run in PostgreSQL 9.6.1) | |
-- Demonstration of how serializable isolation for PostgreSQL, which detects possible | |
-- interference between concurrent transactions, can produce false positives | |
-- in psql, create the following table | |
CREATE TABLE users( | |
id SERIAL NOT NULL PRIMARY KEY, | |
username VARCHAR NOT NULL | |
); |
Some articles and tips about Slotted Counter Pattern:
Pretendo apresentar um código com uma lógica de negócio simples que funciona bem na perspectiva do negócio mas que quebra miseravelmente em ambientes minimamente concorrentes. Para isso, vou demonstrar através de testes de integração como identificar o Race Condition no código e principalmente como resolvê-lo através de mecanismos de locking e Isolation Level do seu banco de dados;
Creates a new repository (aka project) in a specific Gitlab group.
This project was developed with Python v3.9, and it also uses Python's Virtualenv tool. So before working on this project we need to set up it.
Inside this project's folder, execute those commands to configure your environment: