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
| #!/usr/bin/env bash | |
| # GitHub Actions OIDC subject claim helper | |
| # | |
| # Repositories created after July 15, 2026 use an immutable subject (sub) claim | |
| # format that includes numeric owner and repo IDs instead of just names: | |
| # | |
| # New: repo:owner@OWNER_ID/repo@REPO_ID:ref:refs/heads/main | |
| # Old: repo:owner/repo:ref:refs/heads/main | |
| # | |
| # This prevents subject claim reuse if a GitHub username or repo name is recycled |
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
| """ | |
| Gerador de NIFs portugueses de teste válidos. | |
| Formato: [100..999] 000 00 X (onde X é o dígito de controlo) | |
| """ | |
| def calcular_digito_controlo(primeiros_8: str) -> int: | |
| """Calcula o dígito de controlo de um NIF com base nos primeiros 8 dígitos.""" | |
| pesos = [9, 8, 7, 6, 5, 4, 3, 2] | |
| soma = sum(int(d) * p for d, p in zip(primeiros_8, pesos)) |
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
| import smtplib | |
| from email.mime.text import MIMEText | |
| from email.mime.multipart import MIMEMultipart | |
| smtp_server = input("smtp server") | |
| smtp_port = 587 # Usually 587 for TLS, 465 for SSL | |
| receiver_email = input("receiver email") | |
| sender_email = input("sender email") | |
| sender_name = input("sender name") |
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
| # Go thru all vercel projects in any of your organizatons and remove the development "target" | |
| # from all secrets that have other targets | |
| import requests | |
| VERCEL_TOKEN = "YOUT_TOKEN" | |
| HEADERS = {"Authorization": f"Bearer {VERCEL_TOKEN}"} | |
| BASE_API_URL = "https://api.vercel.com" |
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
| import csv | |
| import requests | |
| from datetime import datetime | |
| def download_and_save_invoice(url, date_str): | |
| response = requests.get(url) | |
| response.raise_for_status() | |
| file_name = f"ride_{date_str}.pdf" |
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
| #!/bin/sh | |
| # | |
| # Simle utility to fake Python's `webbroser` (https://docs.python.org/3/library/webbrowser.html). | |
| # Usefull for when no GUI is available. For example inside a Docker container. | |
| # | |
| # Copy paste this code the terminal: | |
| export BROWSER="~/fake-browser.sh:$BROWSER" | |
| echo 'echo "Fake browser called with: $@" && touch ~/fake-browser.log && echo "$@" >> ~/fake-browser.log' > ~/fake-browser.sh |
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
| COMMUNICATION_SERVICES_CONNECTION_STRING= | |
| EMAIL_SENDER= |
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
| #!/usr/bin/env python3 | |
| # Copy minecraft NBT properties from one file into another | |
| # Usage: | |
| # ./nbt-copy.py <source_file> <destination_file> <property> [properties] | |
| # | |
| # Requires nbt: | |
| # pip install nbt | |
| import argparse |
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
| // ==UserScript== | |
| // @name HP iLo 4 console shortcut | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Adds a quick link to the HTML5 console in HP's iLo UI. Make sure you match the script to your server(s) IPs | |
| // @author tofran | |
| // @match https://<YPUR_SERVER_IP_HERE>/html/masthead.html | |
| // @grant none | |
| // ==/UserScript== |
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
| const findCacheDir = require('find-cache-dir'); | |
| const Cache = require("file-system-cache").default; | |
| const cache = Cache({ | |
| basePath: findCacheDir({ name: 'storybook' }), | |
| ns: 'storybook' | |
| }); | |
| const cache_data = { | |
| success: true, |
NewerOlder