Skip to content

Instantly share code, notes, and snippets.

View albertocavalcante's full-sized avatar
🎄
Happy Holidays!

Alberto Cavalcante albertocavalcante

🎄
Happy Holidays!
View GitHub Profile
@tokrug
tokrug / ConditionalOnConfigurationProperties.java
Last active August 26, 2025 01:26
Spring Boot autoconfiguration conditional annotation on typesafe ConfigurationProperies class. Maps properties to the provided class and executes it's isPresent() method to determine if Conditional should match or not. application.yml, ExampleSpringConfiguration.java and ExampleSpringPropertiesModel.java show how the rest of the code can be used.
/**
* Metannotation for OnConfigurationPropertiesCondition custom conditional implementation.
*/
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Conditional(OnConfigurationPropertiesCondition.class)
public @interface ConditionalOnConfigurationProperties {
// properties namespace
@moscas
moscas / Sum.groovy
Created December 8, 2020 13:38
Data extractor for IntelliJ which counts the sum of numeric values
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col); getTypeName(Object, col); isStringLiteral(Object, col); }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:
@aalmiray
aalmiray / db.groovy
Last active December 21, 2025 22:02
Groovy/JBang
@Grab('com.oracle.database.jdbc:ojdbc8:19.7.0.0')
@Grab('com.oracle.database.jdbc:ucp:19.7.0.0')
import java.sql.Connection
import java.sql.SQLException
import java.sql.Statement
import java.sql.ResultSet
import oracle.ucp.jdbc.PoolDataSourceFactory
import oracle.ucp.jdbc.PoolDataSource
PoolDataSource pds = PoolDataSourceFactory.poolDataSource.with(true) {
@daehahn
daehahn / wsl2-network.ps1
Last active September 28, 2025 12:00
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@jamescalam
jamescalam / smtp_example.py
Created May 26, 2020 16:53
Example code for sending an email via SMTP with TLS encryption in Python.
import smtplib
# initialize connection to our email server, we will use Outlook here
smtp = smtplib.SMTP('smtp-mail.outlook.com', port='587')
smtp.ehlo() # send the extended hello to our server
smtp.starttls() # tell server we want to communicate with TLS encryption
smtp.login('[email protected]', 'Password123') # login to our email server
@devops-school
devops-school / Terraform-taint-untaint-explained.md
Last active May 23, 2023 05:15
Terraform taint and untaint explained with example programs and tutorials
$ terraform taint resource.id

resource.id refers to the resource block name and resource ID to taint. Review the resource block we 

previously created:

resource "aws_instance" "example" {
  ami           = "ami-b374d5a5"
  instance_type = "t2.micro"
@th-deng
th-deng / build.gradle
Last active January 5, 2022 06:29
Config JaCoCo report and violation rules
// groovy DSL
jacocoTestReport {
reports {
// 원하는 리포트를 켜고 끌 수 있습니다.
html.enabled true
xml.enabled false
csv.enabled false
// 각 리포트 타입 마다 리포트 저장 경로를 설정할 수 있습니다.
@andreasonny83
andreasonny83 / RELEASE-NOTES.md
Last active December 26, 2025 14:17
Release Notes Template

Release Notes Template

Based off https://palantir.quip.com/pzRwAVr1bpzf

Pro-tip: look through the github diff between the previous release to see what's changed. The commit titles should give an outline of what's happened.

Upgrade Steps

  • List out, as concretely as possible, any steps users have to take when they upgrade beyond just dumping the dependency.
  • Write pseudocode that highlights what code should change and how.
@Rich-Harris
Rich-Harris / what-is-svelte.md
Last active December 27, 2025 05:32
The truth about Svelte

I've been deceiving you all. I had you believe that Svelte was a UI framework — unlike React and Vue etc, because it shifts work out of the client and into the compiler, but a framework nonetheless.

But that's not exactly accurate. In my defense, I didn't realise it myself until very recently. But with Svelte 3 around the corner, it's time to come clean about what Svelte really is.

Svelte is a language.

Specifically, Svelte is an attempt to answer a question that many people have asked, and a few have answered: what would it look like if we had a language for describing reactive user interfaces?

A few projects that have answered this question:

@mohanpedala
mohanpedala / bash_strict_mode.md
Last active December 26, 2025 11:51
set -e, -u, -o, -x pipefail explanation