Skip to content

Instantly share code, notes, and snippets.

View palmerc's full-sized avatar

Cameron Lowell Palmer palmerc

View GitHub Profile
@palmerc
palmerc / math_commands.py
Last active March 17, 2024 17:37
Multiplication Worksheet
from pylatex import UnsafeCommand
from pylatex.base_classes import CommandBase
from pylatex.package import Package
class Multiplication(CommandBase):
_latex_name = 'mult'
_latex = r'''
$\begin{array}{rr}
@palmerc
palmerc / yaml2plist.py
Created February 28, 2024 14:54
Convert Ansible Inventory yaml to Remote Desktop importable plist
import yaml
import plistlib
import uuid
def main():
hosts = None
with open('inventory.yml') as f:
for yml in yaml.safe_load_all(f):
hosts = yml['all']['children']['production']['hosts']
@palmerc
palmerc / ELKO_README.md
Last active November 14, 2023 12:31
Upgrade Elko Super Thermostat from 1.2.5R to 1.2.6R

Contact Elko support for the latest version of the thermostat firmware.

The version 1.2.6R package contained:

  • ap1.bin
  • avrboot.bin
  • elko_termo_og_boot.BAT

I bought a SanDisk 128GB SD card and formatted for FAT 32 using Disk Utility (macOS). I unzipped the package and copied the files over to the SD card at the command-line. I am using the command-line to avoid any magic the GUI versions might introduce. I also rm'ed any hidden directories and files introduced by the OS. Unmount/eject the SD card.

The upgrade procedure is quite simple actually. As it states on the back of the thermostat:

@palmerc
palmerc / ocsp_check.py
Last active August 3, 2023 06:28
Apple OCSP Check
#!/usr/bin/env python3
import argparse
import pathlib
from cryptography import x509
from cryptography.x509 import ocsp
from cryptography.hazmat.primitives import serialization, hashes
import requests
#!/bin/bash
# Remember to brew install libomp llvm
# I also build libressl
set -ex
ROOT_DIR=$( pwd )
SOURCE_DIR=${ROOT_DIR}/src
def find_codesign_elements(path):
elements = find(path, '*.appex')
elements.extend(find(path, '*.framework'))
elements.extend(find(path, '*.dylib'))
return elements
def find_codesign_artifacts(path):
artifacts = find(path, '_CodeSignature')
artifacts.extend(find(path, 'CodeResources'))
@palmerc
palmerc / build-llvm.sh
Last active April 7, 2021 11:46
Compile LLVM on macOS
#!/usr/bin/env bash
set -e
SCRIPT_DIR=$(pwd)
COMMAND_LINE_TOOLS_DIR=/Library/Developer/CommandLineTools
CLT_USR_INCLUDE=${COMMAND_LINE_TOOLS_DIR}/SDKs/MacOSX.sdk/usr/include
CLT_USR_LIB=${COMMAND_LINE_TOOLS_DIR}/SDKs/MacOSX.sdk/usr/lib
@palmerc
palmerc / no.corporate.wireguard.plist
Last active November 1, 2023 12:44
WireGuard LaunchD Startup
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>no.corporate.wireguard</string>
<key>RunAtLoad</key><true/>
<key>OnDemand</key><false/>
<key>Disabled</key><false/>
<key>WatchPaths</key>
function FindProxyForURL(url, host) {
return "SOCKS 192.168.11.146:8889";
}
function FindProxyForURL(url, host) {
return "SOCKS 192.168.11.146:8889";
}