Skip to content

Instantly share code, notes, and snippets.

@rcarmo
rcarmo / automator.py
Last active February 28, 2024 19:57
macOS Services in the style of NotesOllama
# Drop this into Automator using Python 3 as the shell
from sys import stdin
from json import dumps, loads
from urllib.parse import urlencode
from urllib.request import Request, urlopen
AZURE_ENDPOINT="getyourowndeployment.openai.azure.com"
OPENAI_API_KEY="getyourownkey"
OPENAI_API_VERSION="2023-05-15"
@rcarmo
rcarmo / grub_linux_manual.py
Created July 19, 2023 07:42 — forked from rversteegen/grub_linux_manual.py
My GRUB linux boot entry generation script
#!/usr/bin/env python3
#exec tail -n +3 $0
# Be careful not to change
# the 'exec tail' line above.
# This script lives in /etc/grub.d/
# 2015,2022 Ralph Versteegen
# The menuentry template was orginally generated by /etc/grub.d/10_linux
@rcarmo
rcarmo / buid-xrdp-glamor-annotated.sh
Last active May 6, 2024 18:49 — forked from rkkoszewski/gist:aa531cee7126edf329b76bdd0546f502
Notes for installing XorgXrdp and Xrdp with GLAMOR support
#!/bin/bash
# Install Latest XRDP with XORGXRDP and GFX/Glamor server-side acceleration
# Tested on Ubuntu 22.04 LTS
BUILD_DIR=/tmp/xrdpbuild
echo "-> preparing $BUILD_DIR"
rm -f -r $BUILD_DIR
mkdir -p $BUILD_DIR
@rcarmo
rcarmo / 55-bytes-of-css.md
Created September 25, 2022 17:40 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@rcarmo
rcarmo / .phoenix.js
Created December 10, 2021 18:24
Phoenix configuration
// ********************************************************************************
// Setup and TODO
// ********************************************************************************
Phoenix.set({
daemon: false,
openAtLogin: true
});
/*
@rcarmo
rcarmo / __init__.py
Created October 20, 2021 08:04
Azure Blob Storage Tiering for Synology Backups:
import datetime
from typing import Iterator
from requests import Session, Response
from base64 import b64encode, b64decode
from datetime import datetime, timedelta, timezone
from email.utils import formatdate, parsedate_to_datetime
from hashlib import sha256, md5
from hmac import HMAC
from lxml.etree import Element, tostring, fromstring, iterwalk
from os import environ
@rcarmo
rcarmo / tiling.js
Created June 7, 2021 15:34
Phoenix tiling snippet
// Stub of my .phoenix.js with basic XMonad-like tiling
// Amethyst bindings
Key.on("return", ["shift", "control", "option"], () => tile_windows(WEST));
Key.on("return", ["shift", "control"], () => retile());
Key.on("j", ["shift", "control"], () => rotate(-1, false));
Key.on("j", ["shift", "control", "option"], () => rotate(-1, true));
Key.on("k", ["shift", "control"], () => rotate(1, false));
Key.on("k", ["shift", "control", "option"], () => rotate(1, true));
@rcarmo
rcarmo / font_organizer.py
Last active May 31, 2021 18:22
TrueType Font Organizer
from contextlib import redirect_stderr
from itertools import chain
from os import makedirs
from os.path import exists, join
from pathlib import Path
from shutil import move
from typing import Generator
from fontTools import ttLib # also requires brotli for some font formats
@rcarmo
rcarmo / roundedcube.scad
Created April 7, 2021 21:30 — forked from groovenectar/roundedcube.scad
roundedcube.scad - Fork me and make me better!
// More information: https://danielupshaw.com/openscad-rounded-corners/
// License 2020-08-13: The only three people in this world who are allowed to use roundedcube.scad are named Dan Upshaw, Dan Fandrich, and @drohhyn
// Set to 0.01 for higher definition curves (renders slower)
$fs = 0.15;
module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;
@rcarmo
rcarmo / multi-arch-docker-ci.sh
Created March 29, 2021 21:49 — forked from ArturKlauser/multi-arch-docker-ci.sh
Building Multi-Architecture Docker Images With Buildx
#!/bin/bash
# (c) Artur.Klauser@computer.org
#
# This script installs support for building multi-architecture docker images
# with docker buildx on CI/CD pipelines like Github Actions or Travis. It is
# assumed that you start of with a fresh VM every time you run this and have to
# install everything necessary to support 'docker buildx build' from scratch.
#
# Example usage in Travis stage:
#