Skip to content

Instantly share code, notes, and snippets.

@jcconnell
jcconnell / init.lua
Last active June 11, 2023 23:52
Hammerspoon Spoon to replace clipboard contents with ChatGPT
--- === ChatGPT ===
---
--- Replace clipboard contents with ChatGPT
---
--- Place this file in the ~/.hammerspoon directory with the following structure
--- ── Spoons
---   └── ChatGPT.spoon
---   └── init.lua
---
--- To use, add the following lines to ~/.hammerspooon/init.lua. Replace with your preferred hot key.
@jcconnell
jcconnell / control-container.sh
Created January 8, 2021 07:39
Bash scripts to start / stop Proxmox containers and VMs
#!/bin/bash
# Script to suspend and resume container
# (c) July 2020 JC Connell
# if you want to see your debug messages, uncomment this variable
#DEBUG_IS_ON=yes
# you can use this function for debug messages
# usage: command: "debug File Is Open" --(gives oputput)--> "At 11:44:00 File Is Open"
function debug()
@jcconnell
jcconnell / Safari-Tabs-To-Firefox.scpt
Last active December 15, 2019 07:06
Open All Safari Tabs in Firefox
tell application "Safari"
set tab_list to every tab in the front window
repeat with the_tab in tab_list
set the_url to the URL of the_tab
tell application "Firefox Nightly" to open location the_url
end repeat
end tell
@jcconnell
jcconnell / List of Interesting Yi Commands
Last active March 18, 2024 06:06
Yi Camera (22US) Info, Scripts & Links
# Works Through telnet!
# Disable IR Illumination (Cuts down IR illumination)
/home/sendMq 0x10 1 0x1141 0
# Enable IR Illumination (Cut the IR illumination)
/home/sendMq 0x10 1 0x1140 1
# Enable IR Filter (IR cut filter)
/home/sendMq 0x10 1 0x1147 0
@jcconnell
jcconnell / USG_OpenVPN_Radius_Auth.md
Last active August 28, 2023 09:04
Unifi Security Gateway (USG) OpenVPN server with RADIUS authentication

Last Updated: 8/30/18

Details

I wanted to run an OpenVPN server on the USG. Since it has a Radius server built in, I figured this would be a much better way to handle OpenVPN authentication. Make sure you have the Radius server enabled on your USG under Settings > Services > Radius > Server in the controller. Add OpenVpn users under Settings > Services > Radius > Server.

Thanks to the following resources in helping to configure this:

@jcconnell
jcconnell / sunrail_status.py
Last active August 27, 2018 22:12
This is a custom component for Home Assistant that provides Sunrail train status. Instructions in first comment
"""
Custom Sensor for Sunrail train times.
"""
from collections import defaultdict
from datetime import timedelta, datetime, time
import logging
import voluptuous as vol
@jcconnell
jcconnell / unifi_wifi.sh
Last active December 28, 2023 17:09
A bash script to enable, disable or check the status of a UniFi WiFi network.
#!/bin/bash
unifi_username=USERNAME
unifi_password='PASSWORD'
unifi_controller=https://EXAMPLE.COM:8443
wifi_id=YOUR_WIFI_ID
cookie=/tmp/cookie
curl_cmd="curl -s -S --cookie ${cookie} --cookie-jar ${cookie} --insecure "
@jcconnell
jcconnell / Nortel_5520_Update_Procedures.md
Last active May 17, 2023 04:29
Updating firmware/software on the Nortel 5520 series
@jcconnell
jcconnell / update-adblock-dnsmasq.sh
Created January 22, 2018 20:23 — forked from Ar0xA/update-adblock-dnsmasq.sh
USG DNS adblock/malwareblock
#!/bin/bash
#
#DNS adblock/malware block for USG
#
#Orginal script: https://community.ubnt.com/t5/UniFi-Routing-Switching/Use-USG-to-block-sites-apps-like-ER/td-p/1497045
#
#Howto: SSH into your USG:
#sudo su -
#vi /config/user-data/update-adblock-dnsmasq.sh (add file content)
#ESC :wq