Skip to content

Instantly share code, notes, and snippets.

@jak119
jak119 / prompt.txt
Created December 30, 2023 05:23
OpenAI Home Assistant Prompt
This smart home is controlled by Home Assistant.
An overview of the lights in this home
{%- for state in states.light %}
{%- set light_name = state.name %}
{%- set light_state = state.state %}
- {{ light_name }} is {{ light_state }}
{%- endfor %}
@jak119
jak119 / notify_agent_agenda.yaml
Last active December 29, 2023 22:39 — forked from allenporter/notify_agent_agenda.yaml
Home Assistant Blueprint: Conversation agent Agenda Notification
# Original: https://gist.github.com/allenporter/e70d9eb090c7dbdd593cf526e07b4abe
# Found in comments:
# https://gist.github.com/allenporter/e70d9eb090c7dbdd593cf526e07b4abe?permalink_comment_id=4796049#gistcomment-4796049
blueprint:
name: Daily Conversation agent Agenda Notification
description:
Conversation agent generates a personalized notification based on the
upcoming calendar agenda, location, and weather information in your language.
domain: automation
input:
@jak119
jak119 / Instructions.md
Created April 6, 2020 14:35
Schedule turning on / off the LED on a Unifi APs

How to schedule LED on / off for Unifi APs

Inspired by this blog post but found the scipt didn't work quite right because it used single quotes (') instead of double inside the JSON body. The tweaked scripts look like this:

Turn On

#!/bin/sh

username=admin
@jak119
jak119 / GenerateGitCerts.ps1
Created February 24, 2020 17:10
Copy Root Certs to Windows Git Cert File
$Path = ($env:ProgramFiles + "\Git\mingw64\ssl\certs\ca-bundle.crt")
# Make a backup
Copy-Item $Path ($Path + ".old") -Force
$certs = Get-Childitem cert:\LocalMachine\root -Recurse
foreach ($cert in $certs) {
Add-Content $Path "-----BEGIN CERTIFICATE-----"
Add-Content $Path -Value ([convert]::tobase64string((get-item $cert.PSPath).RawData)) -Encoding Ascii
Add-Content $Path "-----END CERTIFICATE-----"
@jak119
jak119 / proxy.md
Created June 23, 2016 18:26
Brightcove Gallery Reverse Proxy
  1. Add a series of location blocks for the required URIs while being sure to replace XXXX with the proper subdomain as provided by the Gallery
    location /templates/ {
        proxy_pass http://XXXX.bcvp0rtal.com/templates/;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $proxy_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    
    

location /common-assets/ {

@jak119
jak119 / vmware-horizon-ubuntu-instructions.md
Last active May 28, 2023 01:02
Install VMware Horizon Client on Ubuntu

Rough instructions on insatlling the VMware Horizon Client on Ubuntu

  1. Go to https://www.vmware.com/go/viewclients and download the appropriate version
  2. Open terminal and cd to the directory the .bundle file downloaded to
  3. Run chmod +x VMware-Horizon-Client-*
  4. Execute the .bundle file with sudo ./VMware-Horizon-Client-*
  5. Step through the installer being sure to enable drive redirection
  6. Lauch the application with vmware-view
  7. Connect to server
@jak119
jak119 / wp-upgrade.sh
Last active December 31, 2015 19:16
Bash script to update WordPress
#!/bin/bash
#Write Output to Syslog for consumption by logging server
exec 1> >(logger -s -t $(basename $0)) 2>&1
#Update everything via the wp-cli tool (http://wp-cli.org/)
/usr/local/sbin/wp cli update --yes #Update the tool its self first
/usr/local/sbin/wp core upgrade --path='/var/www/html' --quiet
/usr/local/sbin/wp core update-db --path='/var/www/html' --quiet
/usr/local/sbin/wp core update-db --network --path='/var/www/html' --quiet
@jak119
jak119 / generate_docs.ps1
Last active October 3, 2015 19:50
Pandoc to PDF
# This assumes that the script is being run from (or in the context of) a folder that contains all the original markdown files and that you've used a .md suffix
# Because my originals are kept in Sharepoint this only regenerates the files if the original markdown file has changed. This fixes versioning in Sharepoint
$originals = Get-ChildItem . -Filter *.md
foreach ($original in $originals){
$pdf_original = [System.IO.Path]::GetFileNameWithoutExtension($original) + ".pdf"
if ((!(Test-Path ..\$pdf_original)) -or (((Get-ItemProperty -Path $original -Name LastWriteTime).lastwritetime.DateTime) -ge ((Get-ItemProperty -Path ..\$pdf_original -Name LastWriteTime).lastwritetime.DateTime))) {
pandoc -V geometry:paperwidth=8.5in -V geometry:paperheight=11in -V geometry:margin=1in -s -S "$original" -o "..\$pdf_original"
}
}
foreach ($original in $originals){
@jak119
jak119 / OneLiners.md
Last active July 7, 2016 13:20
PowerShell One-Liners

Active Directory One-Liners

Users

Groups

Remove all group members Get-ADGroupMember "TESTGROUP" | ForEach-Object {Remove-ADGroupMember "TESTGROUP" $_ -Confirm:$false}

Add similar groups to one group get-adgroup -filter {name -like "group*end"} | ForEach-Object {Add-ADGroupMember -Identity "TESTGROUP" -Members $_}

Computers

Disable computer account based on name Get-ADComputer COMPUTERNAME | Disable-ADAccount

@jak119
jak119 / mysql_backup.sh
Created December 31, 2014 20:39
Backup MySQL Databases to File
#!/bin/bash
#@author Jamison Kissh
#Schedule the job to run via a cron job
#edit line below to include password after -p
mysqldump -u root -p --all-databases | gzip > ./database`date +%F_%T`.sql.gz
#Remove backups older than five days
find ./database* -mtime +5 -exec rm {} \;