Skip to content

Instantly share code, notes, and snippets.

View C-Loftus's full-sized avatar

Colton Loftus C-Loftus

View GitHub Profile
@C-Loftus
C-Loftus / atspi.rs
Created June 14, 2025 00:13
recursive print atspi
use atspi::connection::set_session_accessibility;
use atspi::proxy::accessible::{AccessibleProxy, ObjectRefExt};
use atspi::proxy::proxy_ext::ProxyExt;
use atspi::{DocumentEvents, Event};
use zbus::Connection;
use std::error::Error;
use tokio_stream::StreamExt;
fn recursive_print_children<'a>(
proxy: &'a AccessibleProxy<'a>,
@C-Loftus
C-Loftus / swap.sh
Created May 18, 2025 18:56
Orca swap capslock for vim
#!/bin/bash
if pgrep -x "orca" > /dev/null; then
echo "Orca is running. Killing Orca and swapping Caps Lock and Escape."
# Kill Orca
pkill -x "orca"
# Swap Caps Lock and Escape
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:swapescape']"
else
echo "Orca is not running. Reverting Caps Lock and Escape to normal and starting Orca."
@C-Loftus
C-Loftus / docker-compose.yml
Created April 21, 2025 20:56
Compose for Postgis
version: '3.5'
services:
postgres:
container_name: postgres_container
image: postgis/postgis
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
PGDATA: /data/postgres
@C-Loftus
C-Loftus / script.sh
Last active April 17, 2025 15:56
Simple pygeoapi with k8s
#!/bin/bash
sudo docker run \
--privileged \
--name k3s-server-1 \
--hostname k3s-server-1 \
-p 6443:6443 \
-d rancher/k3s:v1.24.10-k3s1 \
server
@C-Loftus
C-Loftus / rise_response.json
Created March 6, 2025 14:39
Rise Debugging Response
{
"links": {
"self": "\/rise\/api\/location?include=catalogRecords.catalogItems\u0026itemsPerPage=5\u0026page=1",
"first": "\/rise\/api\/location?include=catalogRecords.catalogItems\u0026itemsPerPage=5\u0026page=1",
"last": "\/rise\/api\/location?include=catalogRecords.catalogItems\u0026itemsPerPage=5\u0026page=121",
"next": "\/rise\/api\/location?include=catalogRecords.catalogItems\u0026itemsPerPage=5\u0026page=2"
},
"meta": {
"totalItems": 603,
"itemsPerPage": 5,
@C-Loftus
C-Loftus / swap.sh
Created February 20, 2025 15:08
Swap capslock and escape on macos
#!/bin/bash
# Check current mapping and extract relevant content
CURRENT_MAPPING=$(hidutil property --get "UserKeyMapping" | grep "HIDKeyboardModifierMappingSrc")
# Define the swap mapping
SWAP_MAPPING='{
"UserKeyMapping": [
{
"HIDKeyboardModifierMappingSrc": 0x700000029,
@C-Loftus
C-Loftus / setupwis2box.sh
Last active December 2, 2024 20:59
Setup WIS2BOX
sudo apt update
sudo apt upgrade
# Docker
sudo groupadd docker
sudo usermod -aG docker $USER
git clone https://github.com/cgs-earth/wis2box/
cd wis2box
python3 wis2box-ctl.py start
@C-Loftus
C-Loftus / query.sparql
Last active September 16, 2024 15:43
graph.geoconnex sample sparql query
PREFIX schema: <https://schema.org/>
PREFIX gsp: <http://www.opengis.net/ont/geosparql#>
PREFIX wiki: <https://www.wikidata.org/wiki/>
PREFIX hyf: <https://www.opengis.net/def/schema/hy_features/hyf/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT
?mainstem
?monitoringLocation
@C-Loftus
C-Loftus / containerify.sh
Last active July 29, 2024 15:30
Add code to spin up pygeoapi in a devcontainer.Run this from the root of the `pygeoapi` directory
mkdir .devcontainer
touch .devcontainer/devcontainer.json
cat <<EOF > .devcontainer/devcontainer.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "Existing Docker Compose (Extend)",
@C-Loftus
C-Loftus / build_orca_master_with_spiel.md
Last active September 14, 2025 21:32
Build Orca Master, optionally with Piper on Ubuntu 24.04

Use the Orca Screen Reader with Piper

Orca support for Piper depends on Spiel which is a more modern speech framework for Linux. This is still experimental, but works well in my use.

This guide was written for Ubuntu 24.04 on July 12 2024.

Clone Orca and install its build dependencies

sudo apt install git
git clone https://gitlab.gnome.org/GNOME/orca/