Skip to content

Instantly share code, notes, and snippets.

View greenygh0st's full-sized avatar
🏠
Working from home - like a lot of us...

Dale Myszewski greenygh0st

🏠
Working from home - like a lot of us...
View GitHub Profile
@greenygh0st
greenygh0st / hubitat-power-meter-mirror.groovy
Created March 20, 2025 03:23
For Hubitat mirror a power meter without exposing a switch
definition(
name: "Power Meter Mirror",
namespace: "bubblelabs",
author: "Dale Myszewski",
description: "Mirrors only the power attribute from a selected device to a virtual device.",
category: "Convenience",
installOnOpen: true,
singleInstance: false,
iconUrl: "https://raw.githubusercontent.com/hubitat/HubitatPublic/master/hubitat.ico"
)
@greenygh0st
greenygh0st / iis-san-csr.md
Last active February 25, 2025 16:18
Request a certificate in IIS when SAN is required

IIS Certificate with SAN

When you absoluetly must deal with IIS and SAN...

  1. Create a request config file for your server
[Version]
Signature="$Windows NT$"

[NewRequest]
Subject = "CN=me.com, OU=YourDepartment, O=YourCompany, L=YourCity, S=YourState, C=US"
@greenygh0st
greenygh0st / FIXIT.md
Created February 13, 2025 23:16
If the trust relationship failed with Active Directory

If the trust relationship fails between a client machine and AD run the following command to fix it:

Reset-ComputerMachinePassword -Credential (Get-Credential) -Server "YourDomainController"

YourDomainController = the FQDN or ip address of the AD server

@greenygh0st
greenygh0st / README.md
Created December 29, 2024 04:56 — forked from aidos-dev/README.md
How to connect Apple AirPods to Linux (Debian/Ubuntu/Mint)

How to connect Apple AirPods to Linux (Debian/Ubuntu/Mint)

Step 1.

Open your terminal.

In the root directory run the command:

sudo nano /etc/bluetooth/main.conf
@greenygh0st
greenygh0st / export-docker-container.md
Created October 31, 2024 14:56
Simple instructions to export a Docker container

To export a Docker container to another host, you can follow these steps:

1. Save the Container as an Image (if needed)

If the container you want to export is running, stop it first:

docker stop <container_id_or_name>
@greenygh0st
greenygh0st / utc-oracle.sql
Created June 5, 2024 22:33
Get the UTC date in Oracle
CREATE OR REPLACE FUNCTION SYSDATEUTC RETURN DATE AS
BEGIN
RETURN CAST(sys_extract_utc(SYSTIMESTAMP) AS DATE);
END SYSDATEUTC;
@greenygh0st
greenygh0st / random-uuid.sh
Created December 28, 2023 19:31
Random UUID in Ruby via CLI
ruby -e "require 'securerandom'; puts SecureRandom.uuid"
@greenygh0st
greenygh0st / ubuntu-only-security-updates.sh
Created October 10, 2023 04:57
Only install security updates on Ubuntu
sudo apt-get -s dist-upgrade | grep "^Inst" | grep -i securi | awk -F " " {'print $2'} | xargs sudo apt-get install -y
@greenygh0st
greenygh0st / pg-chown.sql
Created September 30, 2022 02:03
Change the owner if all objects in a schema
-- taken from: https://dba.stackexchange.com/questions/171739/change-owner-of-all-schema-objects
CREATE OR REPLACE FUNCTION public.chown(in_schema character varying, new_owner character varying)
RETURNS void
LANGUAGE plpgsql
AS $function$
DECLARE
object_types VARCHAR[];
object_classes VARCHAR[];
object_type record;
@greenygh0st
greenygh0st / prettyNumberFormatter.swift
Created July 7, 2022 17:43
Formats numbers into a short hand format for easier reading.
extension Double {
func reduceScale(to places: Int) -> Double {
let multiplier = pow(10, Double(places))
let newDecimal = multiplier * self // move the decimal right
let truncated = Double(Int(newDecimal)) // drop the fraction
let originalDecimal = truncated / multiplier // move the decimal back
return originalDecimal
}
}