This file contains hidden or 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
name: brev.ly pipeline DockerHub | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
build: | |
name: Build |
This file contains hidden or 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
pm.environment.set('currentDate', new Date().toISOString()); | |
inside req body: | |
{ | |
"my-date": "{{currentDate}}" | |
} |
This file contains hidden or 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
https://stackoverflow.com/a/77087453/11842937 | |
sudo rm /var/run/docker.pid | |
sudo apt purge docker.io containerd | |
sudo apt autoremove | |
sudo apt install docker.io containerd |
This file contains hidden or 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
https://learn.microsoft.com/en-us/windows/wsl/systemd#how-to-enable-systemd | |
https://ollama.com/download/linux | |
https://docs.openwebui.com/ | |
https://github.com/open-webui/open-webui | |
1 - sudo nano /etc/wsl.conf | |
2 - Add values | |
[boot] | |
systemd=true |
This file contains hidden or 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
-- INFO: array starts with 0 and position starts with 1 | |
-- INFO: Get position from pathArray1 element that type is group | |
WITH position AS(SELECT position | |
FROM my_table, jsonb_array_elements(data->'path1'->'pathArray1') with ordinality arr(elem, position) | |
WHERE id = 2 AND elem->>'type' = 'group') | |
-- INFO: Insert new value into pathArray1[position].path2.pathArray2 | |
UPDATE my_table | |
SET data = jsonb_insert( |
This file contains hidden or 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
select * from my_table where created_at::date >= '2025-01-07'; |
This file contains hidden or 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
INSERT - jsonb_insert | |
update my_table | |
set my_column = jsonb_insert(my_column, '{field1, field2, newkey}', '"hello insert"') | |
where id = 1; | |
// SELECT result: {"field1": {"field2": {"newvalue": "hello insert"}}} | |
SET - jsonb_set | |
update my_table | |
set my_column = jsonb_set(my_column, '{field1, field2}', '{"existingKey":"bye hello value"}') | |
where id = 1; |
This file contains hidden or 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
https://developer.mozilla.org/en-US/docs/Web/API/MediaStream_Recording_API/Using_the_MediaStream_Recording_API | |
https://mdn.github.io/dom-examples/media/web-dictaphone/ |
This file contains hidden or 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
// https://stackoverflow.com/a/65440696 | |
function random(min, max) { | |
const range = max - min + 1 | |
const bytes_needed = Math.ceil(Math.log2(range) / 8) | |
const cutoff = Math.floor((256 ** bytes_needed) / range) * range | |
const bytes = new Uint8Array(bytes_needed) | |
let value | |
do { | |
crypto.getRandomValues(bytes) |
This file contains hidden or 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
// Info: \u00a0 é o que é o espaço sem quebra | |
const number = 123456.789; | |
console.log(new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(number).replace(/\u00a0/g, ' ')); | |
console.log(Number(number).toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' }).replace(/\u00a0/g, ' ')) | |
// Output: "R$ 123.456,79" |
NewerOlder