Skip to content

Instantly share code, notes, and snippets.

View mromanelli9's full-sized avatar

Marco Romanelli mromanelli9

View GitHub Profile
@mromanelli9
mromanelli9 / hacker-news.js
Created January 4, 2024 10:34
Get the URL of a comment posted on Hacker News
let getCommentURL = (user) => {
let comments = document.querySelectorAll(".athing.comtr");
let selected = [...comments].filter(node => node.querySelector("a.hnuser").text == user);
if (selected.length) {
return `https://news.ycombinator.com/item?id=${selected[0].id}`;
} else {
return undefined;
}
}
@mromanelli9
mromanelli9 / download-keepassxc.sh
Created November 29, 2023 16:28
Download the latest release of KeePassXC for MacOS
#!/bin/bash
LOCATION=$(curl -s https://api.github.com/repos/keepassxreboot/keepassxc/releases/latest \
| jq -r '.assets[] | select(.name | endswith("x86_64.dmg")) | .browser_download_url')
curl -s -L -O "$LOCATION"
curl -s -L -O "$LOCATION.DIGEST"
DIGEST=`ls *.DIGEST`
shasum -a 256 -c "$DIGEST"
@mromanelli9
mromanelli9 / Dockerfile
Last active March 23, 2021 18:10
Dockerfile template for python applications
FROM python:3.9-slim
LABEL maintainer="YOUR_NAME_HERE <YOUR_EMAIL_HERE>"
# Run as non-root user
RUN useradd -ms /bin/bash appuser
USER appuser
# Upgrade pip
RUN pip install --upgrade pip