Skip to content

Instantly share code, notes, and snippets.

@gonzalad
gonzalad / A_UUID_v7_for_Postgres.sql
Created January 7, 2026 21:05 — forked from kjmph/A_UUID_v7_for_Postgres.sql
Postgres PL/pgSQL function for UUID v7 and a bonus custom UUID v8 to support microsecond precision as well. Read more here: https://datatracker.ietf.org/doc/rfc9562/
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
create or replace function uuid_generate_v7()
returns uuid
as $$
begin
-- use random v4 uuid as starting point (which has the same variant we need)
-- then overlay timestamp
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string
return encode(
@gonzalad
gonzalad / head-api.yaml
Created April 27, 2021 12:43
[BUG] Invalid @HeadMapping annotation generated in Spring controller
openapi: "3.0.0"
info:
version: 1.0.0
title: Swagger Petstore
license:
name: MIT
servers:
- url: http://petstore.swagger.io/v1
paths:
/pets:
@gonzalad
gonzalad / kubernetes_commands.md
Created January 28, 2020 22:00 — forked from edsiper/kubernetes_commands.md
Kubernetes Useful Commands
@gonzalad
gonzalad / PropertyLogger.java
Created November 5, 2019 21:41 — forked from sandor-nemeth/PropertyLogger.java
Spring Boot - Log all configuration properties on application startup
package de.idealo.ecommerce.order.history.config;
import java.util.Arrays;
import java.util.stream.StreamSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.env.AbstractEnvironment;
@gonzalad
gonzalad / Jenkinsfile
Created January 3, 2019 20:08 — forked from bvis/Jenkinsfile
Jenkin pipeline definition example to be integrated with Docker Swarm cluster in our CI/CD environment
pipeline {
agent { node { label 'swarm-ci' } }
environment {
TEST_PREFIX = "test-IMAGE"
TEST_IMAGE = "${env.TEST_PREFIX}:${env.BUILD_NUMBER}"
TEST_CONTAINER = "${env.TEST_PREFIX}-${env.BUILD_NUMBER}"
REGISTRY_ADDRESS = "my.registry.address.com"
SLACK_CHANNEL = "#deployment-notifications"
openapi: 3.0.0
info:
description: Api Documentation
version: '1.0'
title: Api Documentation
termsOfService: 'urn:tos'
contact: {}
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0'
public class ProjectController {
private List<ProjectResource> projectResources = Arrays.asList(new ProjectResource("myProject1"), new ProjectResource("myProject2"));
@PreAuthorize("#oauth2.hasScope('urn:talend:project:read')")
@RequestMapping(method = RequestMethod.GET)
public List<ProjectResource> findAllProjects(Authentication authentication) {
// get projects from repository
List<ProjectResource> projectResources = this.projectResources;
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.0//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
@gonzalad
gonzalad / newformat.txt
Last active August 17, 2016 14:17
Java code formatting for DSL
package org.xxxx.iam.bla.converters;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
input {
file {
path => "/var/log/apache2/other_vhosts_access.log"
type => "apache"
start_position => beginning
ignore_older => 0
#sincedb_path => "/dev/null"
}
file {
path => "/home/agonzalez/git-projects/platform-services/sandbox/agonzalez-app/data-service/data-service.json.log"