Skip to content

Instantly share code, notes, and snippets.

View brunoamaral's full-sized avatar
😎

Bruno Amaral brunoamaral

😎
View GitHub Profile
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: mail@brunoamaral.eu
###
@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
@DeLorean:~/Digital-Insanity$ hugo --cleanDestinationDir
Building sites … fatal error: runtime: out of memory
runtime stack:
runtime.throw(0x12202bd, 0x16)
/usr/local/go/src/runtime/panic.go:617 +0x72
runtime.sysMap(0xc04c000000, 0x4000000, 0x1eb5cd8)
/usr/local/go/src/runtime/mem_linux.go:170 +0xc7
runtime.(*mheap).sysAlloc(0x1e8ef80, 0x484000, 0x1e8ef90, 0x242)
/usr/local/go/src/runtime/malloc.go:633 +0x1cd
@brunoamaral
brunoamaral / example-nginx.conf
Created February 18, 2019 13:11
example nginx.conf for hugo websites
server {
server_name .DOMAIN-NAME;
listen 80;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
gzip on;
@brunoamaral
brunoamaral / basicAuth.sh
Last active December 18, 2020 20:11
a simple script to password protect a directory on nginx
#!/bin/bash
INCLUDE="/etc/nginx/incl/basicauth.conf"
SOURCEDIR="/home/Digital-Insanity/content/"
read -p "Website nginx directory without trailling slash [/var/web/brunoamaral.eu]:" publicDir
publicDir=${publicDir:-/var/web/brunoamaral.eu}
read -p "Which directory should we protect? (no trailling slash)" relUrl
htpasswd -c "$publicDir$relUrl/.htpasswd" nginx;
cp "$publicDir$relUrl/.htpasswd" "$SOURCEDIR$relUrl"