Skip to content

Instantly share code, notes, and snippets.

View pedroxs's full-sized avatar

Joaquim Pedro Silveira pedroxs

View GitHub Profile
@pedroxs
pedroxs / the-prompts.md
Created August 7, 2025 13:21
LLM prompt snippets

LLM Prompts galore

Source: Kuba Kwiecien

"You are a top-tier, full-stack TypeScript developer and an exceptional software architect with significant startup experience. You know how to design and write things in a way that is robust, yet without overcomplicating them and cutting corners where it's okay to, for the sake of development speed. You are very sharp, straightforward, and brutally honest.

[DESCRIBE YOUR FEATURE/BUG/GOAL HERE]

Analyze all of this carefully, browse the codebase for additional context, ask me clarifying questions, and then come up with three potential solutions and recommend the best one. Do not write any code; just tell me what the three solutions are, their pros and cons, and which one you recommend."
@pedroxs
pedroxs / remove-bg.sh
Created March 22, 2024 13:35
Helper tool to remove background from images
#!/bin/bash
# Remove background from images
# use zenity to read a directory and store in a variable
dir=$(zenity --file-selection --directory --title="Escolha uma pasta" --filename="$HOME/")
if [ -z "$dir" ]; then
exit
fi
@pedroxs
pedroxs / list-games.js
Created March 22, 2018 13:53
Creates a list of game names and size from Humble Bundle library
// $('div.column.subproducts-holder.js-subproducts-holder').children().slice(0, 5).each(function (i, it) {
$('div.column.subproducts-holder.js-subproducts-holder').children().each(function (i, it) {
let $it = $(it);
$it.click();
let gName = $it.find('h2').text();
while ($(`div.details-heading:contains("${gName}")`) < 1) {
console.log('wait');
}
let $div = $('div.js-download-button.download-button:visible');
@pedroxs
pedroxs / script-console.groovy
Created August 29, 2017 18:39
Running shell commands with error redirection on Jenkins Script Console
def cmd = "ls -l"
println new ProcessBuilder('sh','-c',cmd).redirectErrorStream(true).start().text
@pedroxs
pedroxs / steps_for_dic_file.txt
Last active May 23, 2017 19:41
Install dictionaries to use with IntelliJ
# reference StackOverflow: https://stackoverflow.com/a/1950073/1453658
❯ sudo dnf install aspell-pt_BR
❯ aspell --lang pt_BR dump master | aspell --lang pt_BR expand | tr ' ' '\n' > portugues.dic
@pedroxs
pedroxs / resty-auth.sh
Created May 8, 2017 13:46
easily generate authenticated resty header config for specified url
# easily generate authenticated resty header config for specified url
export _url=http://localhost:8080
resty $_url -H "Content-Type: application/json" -H "Accept: application/json" -H "$(curl -s $_url/api/authenticate -d '{"username":"admin","password":"admin","rememberMe":true}' -H 'Content-Type: application/json;charset=UTF-8' | jq '"Authorization: Bearer " + .id_token' -r)"
@pedroxs
pedroxs / jq-filters.sh
Last active March 22, 2025 00:02
jq - recursive search for keys containing "string" stripping empty results
# recursive search for keys containing "string" stripping empty results
jq '.. | objects | with_entries(select(.key | contains("ftp"))) | select(. != {})'
# same, but output propper array
jq '[ .. | objects | with_entries(select(.key | contains("ftp"))) | select(. != {}) ]'
# or
jq 'map( .. | objects | with_entries(select(.key | contains("ftp"))) | select(. != {}) )'
# transform input from {type: a, amount: 1} to {a: 1} and sum all values by type
jq '[ .[] | {(.type): .amount} ] | map(to_entries) | add | group_by(.key) | map({key: .[0].key, value: map(.value) | add}) | from_entries'
@pedroxs
pedroxs / boleto.js
Created January 19, 2017 00:52
Bookmarlet que insere boleto no Santander
(function() {
'use strict';
var codigoBarras = prompt().replace(/\D/g, '');
var inputs = document
.querySelector('frame[name="Principal"]')
.contentWindow.document
.querySelector('frame[name="Corpo"]')
.contentWindow.document
.querySelector('iframe#iframePrinc')
.contentWindow.document
@pedroxs
pedroxs / dne-to-utf8.sql
Created December 6, 2016 15:19
DNE - from latin1 to utf8
-- updates dump from http://www.republicavirtual.com.br/cep/index.php from latin1 to utf8
UPDATE cep_unico SET Nome = CONVERT(CONVERT(CONVERT(Nome USING latin1) USING binary) USING UTF8);
UPDATE cep_unico SET NomeSemAcento = CONVERT(CONVERT(CONVERT(NomeSemAcento USING latin1) USING binary) USING UTF8);
UPDATE cep_unico SET Cep = CONVERT(CONVERT(CONVERT(Cep USING latin1) USING binary) USING UTF8);
UPDATE cep_unico SET UF = CONVERT(CONVERT(CONVERT(UF USING latin1) USING binary) USING UTF8);
UPDATE ac SET cidade = CONVERT(CONVERT(CONVERT(cidade USING latin1) USING binary) USING UTF8);
UPDATE ac SET logradouro = CONVERT(CONVERT(CONVERT(logradouro USING latin1) USING binary) USING UTF8);
UPDATE ac SET bairro = CONVERT(CONVERT(CONVERT(bairro USING latin1) USING binary) USING UTF8);
@pedroxs
pedroxs / CustomEventHandler.java
Last active August 23, 2016 12:17
How to register Hibernate events using JavaConfig so it is possible to use Spring Managed Beans
@Component
public class CustomEventHandler implements PreInsertEventListener, PreUpdateEventListener, PostInsertEventListener, PostUpdateEventListener {
private int someProperty;
@Value("${some-property:20}") // Also possible to use @Autowire if needed =)
public void setSomeProperty(int someProperty) {
this.someProperty = someProperty;
}