Skip to content

Instantly share code, notes, and snippets.

View brunoamaral's full-sized avatar
😎

Bruno Amaral brunoamaral

😎
View GitHub Profile
@brunoamaral
brunoamaral / find-total.py
Last active February 23, 2025 20:31
paperless-ngx, post consume script to fill in a custom field with the total for an invoice
#!/usr/bin/env python3
import os
import requests
import sys
import re
# Environment variables for Paperless API
PAPERLESS_API_URL = os.getenv("PAPERLESS_API_URL", "http://localhost:8000/api")
PAPERLESS_API_TOKEN = os.getenv("SCRIPT_PAPERLESS_API_TOKEN", None)
HEADERS = {"authorization": f"Basic {PAPERLESS_API_TOKEN}"}
@brunoamaral
brunoamaral / gregory-ai-simple-api.html
Created December 22, 2024 21:28
An example on how to embed the Gregory-AI articles into any website
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Articles List</title>
</head>
<body>
<ol id="articles-list"></ol>
@brunoamaral
brunoamaral / rengerar-eu.html
Last active December 22, 2024 21:27
listing gregory-ai articles with plain javascript - regeneration of the CNS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Articles List</title>
</head>
<body>
<ol id="articles-list"></ol>
johnny
description: Desktop Computer
product: Z83 II (Default string)
vendor: AZW
version: Default string
serial: Default string
width: 64 bits
capabilities: smbios-3.0.0 dmi-3.0.0 smp vsyscall32
configuration: boot=normal chassis=desktop family=Default string sku=Default string uuid=03000200-0400-0500-0006-000700080009
*-core
@brunoamaral
brunoamaral / notion2pdf.sh
Last active September 22, 2022 17:55
This bash script takes the export of a Notion page and converts to a PDF with a cover page and table of contents
#!/bin/zsh
####
# This script assumes that you have installed https://github.com/Wandmalfarbe/pandoc-latex-template and that your input is a markdown file from https://www.notion.so/
# Converting to PDF requires MacTex or equivalent to be installed.
# Cover page background is hardcoded to "~/.pandoc/backgrounds/background7.pdf", change it.
# Author is hardcoded to "Lisbon Collective", https://lisboncollective.com/
# Usage: ./notion2pdf.sh inputFile.md
# Questions: [email protected]
###
@brunoamaral
brunoamaral / upgrade-hugo.sh
Created December 21, 2021 10:26
This tiny script will fetch and install the latest version of Hugo in Ubuntu.
#! /bin/bash
wget https://github.com`wget -qO- https://github.com/gohugoio/hugo/releases/latest | grep -oE -m 1 '/gohugoio/hugo/releases/download/v[0-9].[0-9][0-9].[0-9]/hugo_extended_[0-9].[0-9][0-9].[0-9]_Linux-64bit.deb'`
tar -xzf hugo*.tar.gz
sudo dpkg -i hugo*.deb && rm hugo*.deb;
[{"id":"c8971770.2bcb98","type":"file","z":"d7b932b9.f6cb4","name":"","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":1050,"y":440,"wires":[["5759783a.949fa8"]]},{"id":"57fad02e.17f44","type":"rbe","z":"d7b932b9.f6cb4","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":true,"property":"payload","x":930,"y":420,"wires":[["c8971770.2bcb98"]]},{"id":"992b766a.f1a868","type":"change","z":"d7b932b9.f6cb4","name":"destino","rules":[{"t":"set","p":"filename","pt":"msg","to":"\"/NAS/Invoices_Archive/\" & $substring($now(),0,13) & \"h\" & $substring($now(),14,2) & \"mn_\" & msg.payload.filename","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"payload.content","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":420,"wires":[["57fad02e.17f44","8490a08.3588e6"]]},{"id":"3e3b1204.c9300e","type":"switch","z":"d7b932b9.f6cb4","name":"PDF?","property":"payload.contentType","propertyType":"msg","rules":[{"t":"eq","v":"
@brunoamaral
brunoamaral / flow.json
Created May 28, 2021 13:07
Node-Red flow for a telegram bot that adds tasks to Notion.so
[
{
"id": "2dec1e89.a9a582",
"type": "chatbot-telegram-receive",
"z": "b05ba402.a21508",
"bot": "21c9917c.15264e",
"botProduction": "21c9917c.15264e",
"x": 170,
"y": 640,
"wires": [
@brunoamaral
brunoamaral / copyright.html
Created May 31, 2020 09:24
Automatic Unsplash Copyright Shortcode for Hugo
@brunoamaral
brunoamaral / _gallery.scss
Created May 8, 2019 20:53
scss for gallery