Category Archives: Programming

How to write to Google Sheet with API in PHP

  1. Get a service account key from (You can here also restrict what this keys is allowed todo)
    1. When creating, make sure you click the Furnish a new private key
    2. Select JSON when it asks you how to download the key.
  2. The service account key you have just generated includes a client_email.
    1. Go to you google spreadsheet and allow this client_email to have write access on this document

How to Migrate FreePBX server to a new server

-Install FreePBX on New Server
-Run a full backup on current server
-Deactivate the license on the current server –
-Activate new server via SSH – fwconsole sysadmin activate deployementID
-Run a restore on the new server using the backup file from step above
-Change External Address from Settings > SIP Settings to new IP Address
-Update Firewall settings with new IP Address

Update Unifi Controller on Linux

If you have a controller on a Linux box, use the following commands to update the system and install the new update

Code Signing Desktop App

  1. Open a Powershell prompt.
  2. Create a new self-signed certificate for Code signing using “New-SelfSignedCertificate -DnsName “” -Subject “CN=The Name of Your App” -Type CodeSigningCert -CertStoreLocation cert:\CurrentUser\My“. This will create a certificate in the Personal\Certificates folder of the Certificate Manager. You can view this by running “certmgr.msc” from a Run box.
  3. Export the certificate’s public key to an external file for import into the trusted publishers folder of Certificate Manager using “Export-Certificate -Cert (Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert)[0] -FilePath “My Code Signing Cert.cer”. Note the “[0]” brackets after the Get-ChildItem call. This implies that the certificate that you want to export is the first child item found. If you have multiple code signing certificates in your Personal storage you may need to modify this parameter. You can always double-click on the CER file that is exported to see if you’ve gotten the correct certificate.
  4. Import the certificate file that you just exported to the trusted publishers storage using “Import-Certificate -FilePath ‘.\My Code Signing Cert.cer’ -Cert cert:\CurrentUser\Root“. This will trust the certificate on your development workstation.
  5. Finally, sign the executable file using “Set-AuthenticodeSignature .\MyApp.exe -Certificate (Get-ChildItem cert:\CurrentUser\My -CodeSigningCert)[0]”. The same caveat regarding the “[0}” array index applies here. This is the command that I could not locate. I kept using SignTool to sign the executable but it never worked. I’m not sure if it was the trusted publisher problem, or this step. This command specifies Authenticode so I think this may have had the most impact.

After that you should have the executable show up with a certificate when authenticating with Quickbooks.

Note: I got most of the information that I used from this StackOverflow Q&A, particularly the answer from @chaami:

Github publickey denied

If you ever get a publickey denied error while trying to setup a github repo on a hosting account follow these steps.

  1. Create a new Public/Private SSH on server
  2. Copy public key and add a “deploy key” on github
  3. Add your privatekey to the git config