Skip to content

Instantly share code, notes, and snippets.

View gbzarelli's full-sized avatar
Coding...

Guilherme Biff Zarelli gbzarelli

Coding...
View GitHub Profile
import com.tngtech.archunit.junit.AnalyzeClasses;
import com.tngtech.archunit.junit.ArchTest;
import com.tngtech.archunit.lang.ArchRule;
import static com.tngtech.archunit.library.Architectures.layeredArchitecture;
@AnalyzeClasses(packages = "br.com.helpdev.myapp")
class ArchitectureTest {
@ArchTest
@gbzarelli
gbzarelli / 0_custom_EntityPicker.md
Last active October 27, 2024 19:26
Backstage - Custom EntityPicker with Type Filter #helpdev-blog

Custom EntityPicker with Type filter

  • Create folder: packages/app/src/scaffolder/CustomEntityPickerExtension
  • Put files: CustomEntityPickerExtension.tsx and index.ts
  • Edit packages/app/src/App.tsx and insert:
[...]

import { CustomEntityPickerExtension } from './scaffolder/CustomEntityPickerExtension';
@gbzarelli
gbzarelli / gitlabPipe.js
Last active April 18, 2025 22:18
Backstage Action - Gitlab Pipeline: Start a new pipeline. #helpdev-blog
import { Gitlab } from '@gitbeaker/node';
import { createTemplateAction } from '@backstage/plugin-scaffolder-backend';
import { ScmIntegrationRegistry } from '@backstage/integration';
import { InputError } from '@backstage/errors';
import { parseRepoUrl } from './util';
export const createGitlabPipelineAction = (integrations: ScmIntegrationRegistry) =>
createTemplateAction<{
repoUrl: string;
branchName: string;
@gbzarelli
gbzarelli / 1)_template.js
Last active October 27, 2024 19:27
Backstage – Transformando e Reutilizando variáveis em seu template com uma action customizada #helpdev-blog
// The action
// path: packages/backend/src/plugins/scaffolder/actions
import { CatalogApi } from '@backstage/catalog-client';
import { parseEntityRef } from '@backstage/catalog-model';
import {
createTemplateAction,
} from '@backstage/plugin-scaffolder-backend';
@gbzarelli
gbzarelli / SendAndWait.java
Last active October 27, 2024 19:28
Java - Emitter send and wait #helpdev-blog
private final Emitter<MyObject> emitter;
@Override
public void sendingAndWait(final MyObject payload) {
final var future = new CompletableFuture<Void>();
final var message = Message.of(payload,
() -> success(future),
(reason) -> failure(future, reason));
emitter.send(message);
future.toCompletableFuture().join();
@gbzarelli
gbzarelli / sns_subscriptions_migration.py
Last active October 27, 2024 19:28
SNS - Subscriptions Migrate - This script duplicate all subscriptions from one SNS topic to another #helpdev-blog
import boto3
ACCESS_KEY = "-"
SECRET_KEY = "-"
REGION_FROM = "sa-east-1"
TOPIC_ARN_FROM = "arn:aws:sns:sa-east-1:000000000:teste-zarelli-topic"
REGION_TO = "us-east-1"
TOPIC_ARN_TO = "arn:aws:sns:us-east-1:000000000:teste-zarelli-topic"
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
interface Gzip {
@gbzarelli
gbzarelli / 0_ADR_README.md
Last active October 27, 2024 19:29
Architecture Decision Record #helpdev-blog

Architecture Decision Record

An Architectural Decision (AD) is a software design choice that addresses a functional or non-functional requirement that is architecturally significant. An Architecturally Significant Requirement (ASR) is a requirement that has a measurable effect on a software system’s architecture and quality. An Architectural Decision Record (ADR) captures a single AD, such as often done when writing personal notes or meeting minutes; the collection of ADRs created and maintained in a project constitute its decision log. All these are within the topic of Architectural Knowledge Management (AKM). - https://adr.github.io/

Know more:

@gbzarelli
gbzarelli / order_generation.md
Last active October 27, 2024 19:30
Gerador de orders em formato de string desenvolvido em GO | Lindando com sincronismo em GOLang #helpdev-blog
@gbzarelli
gbzarelli / linux.md
Last active December 9, 2023 12:29
Linux Customize after install

after all

  • sudo apt-get update
  • sudo apt-get upgrade

basic installs:

  • sudo apt-get install git
  • sudo apt-get install tilix
  • sudo update-alternatives --config x-terminal-emulator

fish