Skip to content

Instantly share code, notes, and snippets.

View lexicalunit's full-sized avatar
🏳️‍🌈
Keeper of balance

Amy Troschinetz lexicalunit

🏳️‍🌈
Keeper of balance
View GitHub Profile
@lexicalunit
lexicalunit / git-arc
Created October 2, 2023 20:09
git-arc script for archiving and restoring branches
#!/bin/bash
usage() {
(
echo "usage: ${0##*/} COMMAND [args] [-h|--help]"
echo "Tool for archiving and restoring git branches."
(
echo " -h, --help@ show usage help"
echo " create BRANCH@ create an archive ref for the given branch"
echo " list@ list archived branches"
@lexicalunit
lexicalunit / spellbot.py
Last active September 30, 2021 21:56
Automatically sync commands only if needed
import json
import logging
from typing import Any, List, cast
import discord
from deepdiff.diff import DeepDiff
from discord_slash import SlashCommand
from discord.ext.commands import Bot
logger = logging.getLogger(__name__)
@lexicalunit
lexicalunit / install-meeting_detector-agent.sh
Created February 23, 2021 21:51
Installs our meeting_detector script as a macOS LaunchAgent.
#!/bin/bash
set -e
# The meeting_detector script: https://gist.github.com/lexicalunit/ff7bb0981cb92ee5ce1cac6f83e1c248
AGENT="$HOME/Library/LaunchAgents/com.lexicalunit.meeting_detector.plist"
cat >"$AGENT" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
@lexicalunit
lexicalunit / meeting_detector
Created February 23, 2021 21:47
Runs forever and detects when you're in a meeting, updating BlinkStick as needed.
#!/bin/bash
source "$HOME/.blickstick_utilities"
APP="zoom.us"
OP="osascript -e 'tell application \"System Events\" to (name of processes) contains \"$APP\"'"
FIREFOX_TABS="firefox-tabs"
is_running() {
TABS="$($FIREFOX_TABS | grep 'meet.google.com')"
@lexicalunit
lexicalunit / blickstick_utilities
Last active February 23, 2021 21:41
Some bash script utilities for working with BlinkStick
#!/bin/bash
# Source this file to import these utilites into your scripts.
BLINK_LOCK="/tmp/.blinkstick-toggle"
touch "$BLINK_LOCK"
# Choose the python needed for blinkstick and the path to blinkstick
BS="/usr/bin/python /usr/local/bin/blinkstick"
@lexicalunit
lexicalunit / google_meet_is_running
Last active February 23, 2021 21:15
Detect if Firefox is running meet.google.com on macOS.
#!/usr/bin/bash
# See https://gist.github.com/lexicalunit/db01dbb0c1c1dc81f54cf31a825d0920 for firefox-tabs.
firefox-tabs | grep -q "meet.google.com"
@lexicalunit
lexicalunit / firefox-tabs
Last active February 23, 2021 21:02
Print out the URLs in the tabs currently in Firefox on macOS.
#!/usr/bin/env python3
import argparse
import json
import pathlib
# You'll need to install python-lz4: https://pypi.org/project/lz4/
import lz4.block
parser = argparse.ArgumentParser(description="List open urls in Firefox tabs")
@lexicalunit
lexicalunit / zoom_is_running
Created February 23, 2021 20:55
Detect if Zoom is running on macOS.
#!/bin/bash
APP="zoom.us"
OP="osascript -e 'tell application \"System Events\" to (name of processes) contains \"$APP\"'"
test "$(eval "$OP")" = "true"
1 Blue Mana Battery
2 Arena of the Ancients
1 Fire Diamond
2 Library of Leng
1 Feroz's Ban
1 Kormus Bell
3 Sunstone
1 Bubble Matrix
1 Horn of Greed
1 Predator, Flagship
{
"document": {
"document_id": "1",
"documentType": "Nomina Normal",
"document": "Nomina",
"documentName": "Nomina 325",
"documentNumber": "320",
"date": "2016-01-13",
"company": "SHMEX",
"currency": "Pesos",