This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $('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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cmd = "ls -l" | |
println new ProcessBuilder('sh','-c',cmd).redirectErrorStream(true).start().text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Test DB profile | |
spring: | |
profiles: db | |
jpa: | |
database: MYSQL | |
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect | |
generate-ddl: true | |
hibernate: | |
ddl-auto: create-drop |
NewerOlder