Posts

Fixing XCreds error "Invalid tokens or password not determined."

Image
When using XCreds on macOS to synchronize passwords with an IdP, you may encounter an error that states "Invalid tokens or password not determined. Please check the log." This is because XCreds requires a password-based login to synchronize the latest credentials with the local machine. To resolve the issue, simply use the password based sign in rather than passwordless to re-sync. 1. Open XCreds from the menu bar. Open XCreds from the menu bar. Choose either Sign-in if you are signed out or Refresh if you are already logged in. Enter your IdP username/e-mail. Instead of using the normal passwordless flow, choose Use your password instead . Enter your password, then approve the prompt in the Authenticator app as usual to confirm.

Configuring Microsoft 365 DKIM Records on Google Domains

Recently I was attempting to configure mail security for a client, but for some strange reason the CNAME records for 365 DKIM were being extremely stubborn. I found that the UI within G Domains is a little picky about how it will accept the values that 365 is asking you to provide. It will also attempt to auto-qualify your record value if it does not include a trailing period. Go to DNS settings in G Domains. Scroll to Custom resource records . In the Name (also called Host) field, enter the value suggested by 365 . NOTE: The UI will not allow you to type  a period in this field. You can  however copy-paste the value in or edit it after you have saved the record to include it. selector1._domainkey Change the record type to CNAME . Leave the TTL value at 1hr/3600sec. In the Data field, enter the value that correlates to your custom domain. In the below example, I'm pretending that my custom domain name is "domainname.net" and my initial domain is the generated one I recei

Get Future Occurrences of Black Friday in SQL Server

-- Declare # of years you want dates for, the month, the day, and the occurrence of that day within the month declare @years tinyint = 15; declare @month_name varchar(10) = 'November'; declare @day_name varchar(10) = 'Friday'; declare @week_num tinyint = 4; -- Build the calendar WITH calendar AS (   SELECT CAST(getdate() as date) AS [date]   UNION ALL   SELECT DATEADD(dd, 1, [date])   FROM calendar   WHERE DATEADD(dd, 1, [date]) <= dateadd(year,@years,getdate()) ) -- Get the month and days that apply , month_days as ( SELECT [date]   ,row_number() over (partition by year([date]),month([date]) order by date asc) as [week_num] FROM calendar where 1=1 and DATENAME(weekday,[date]) = @day_name and datename(month,[date]) = @month_name ) -- Get the dates where the occurrence matches select [date] from month_days where week_num = @week_num OPTION (MAXRECURSION 0) --Unlimited recursion; limit the number of years in parameter at the top ;

Automated Stored Procedure Parameter Logging in SQL Server

-- Create a test DB CREATE DATABASE [testdb]; go -- Switch the DB context USE [testdb]; go -- Create a basic logging table CREATE TABLE dbo.sp_log ( id BIGINT NOT NULL IDENTITY(1, 1), proc_name NVARCHAR(50) NOT NULL, execution_time DATETIME NOT NULL, params NVARCHAR(max) NULL ); go -- Create a sample target SP that accepts a couple of parameters CREATE PROCEDURE [dbo].[Test_proc] (@param1 VARCHAR(50), @param2 VARCHAR(50)) AS BEGIN -- Whatever your other stored procedures do goes here. -- Just selecting the params back out as an example. SELECT @param1, @param2; END; go -- Create the helper proc to handle parsing of sp and its param values CREATE PROCEDURE dbo.Sp_helper (@args NVARCHAR(max)) AS BEGIN -- Figure out where the SP name ends and the params begin DECLARE @paramstartpos INT = Charindex('||', @args,

LocalPhone.com Configuration with FreePBX

As of writing this article, LocalPhone.com has the cheapest inbound ($3 setup fee + $0.99/mo) and outbound ($.005/min) trunk rates available. For a basic PBX use, this is really all I was looking for. LocalPhone Configuration Sign up for an account at LocalPhone.com . Add a minimum of $5 credit. This covers one incoming DID and an extra dollar for testing purposes. Once the credit has been applied (you'll receive an e-mail), go to Services>Incoming Numbers>See Our Incoming Number prices. Click on your country. Click on your state/province/territory. Choose a dialing code. Click "Get an Incoming Number from <your choice here>". The incoming number (AKA: DID) should be provisioned quickly after confirming details. Click My Account>Incoming Numbers to confirm it has been provisioned. Click Manage Number. Under "Forward incoming calls", choose forwarding to your Internet Phone service. Click My Account>Internet Phone. Take note

Calculating Week Buckets in SQL

Image
I needed to be able to create static week buckets within a single month to be able to group some fact measures by time period. The below accepts a date and then determines the buckets for that month. This will also correctly handle leap years as well. This can be used to join to fact tables for grouping into week buckets. DECLARE @date DATE = '2020-02-12' ; WITH weekcalendar AS ( SELECT  * FROM (          SELECT  1 as WeekNum,  DATEFROMPARTS ( YEAR ( @date ), MONTH ( @date ), 1 ) AS WeekStartDate , DATEFROMPARTS ( YEAR ( @date ), MONTH ( @date ), 7 ) AS WeekEndDate UNION SELECT  2 as WeekNum,  DATEFROMPARTS ( YEAR ( @date ), MONTH ( @date ), 8 ) AS WeekStartDate , DATEFROMPARTS ( YEAR ( @date ), MONTH ( @date ), 14 ) AS WeekEndDate UNION SELECT  3 as WeekNum,  DATEFROMPARTS ( YEAR ( @date ), MONTH ( @date ), 15 ) AS WeekStartDate , DATEFROMPARTS ( YEAR ( @date ), MONTH ( @date ), 21 ) AS WeekEndDate UNION SELECT  4 as WeekNum,  DATE

Google Domains Dynamic DNS and DDClient 3.8.2

Recently switched my domain registrar over to Google Domains and wanted to take advantage of their built-in dynamic DNS capability rather than using a third-party service. This simplifies my configuration and points a subdomain configured on G Domains directly to my internal network. To get this working, I needed a client running inside the network to update the dynDNS record. I decided to go with DDClient on Debian Linux since I already have PiHole running 24/7 in a VM. DDClient documentation states that the "googledomains" protocol is supported as of revision 171, but a quick apt-get install of the daemon only gave me v3.8.2. I was able to get it up and running (after setting up a synthetic record on G Domains) by using the below in my ddclient config file: # Configuration file for ddclient generated by debconf # /etc/ddclient.conf protocol=dyndns2 use=web server=domains.google.com ssl=yes login=yourusername password='yourpassword' subdomain.yourdomain.com Once you&