Skip to content

Instantly share code, notes, and snippets.

View nmoinvaz's full-sized avatar

Nathan Moinvaziri nmoinvaz

  • Phoenix, United States
View GitHub Profile
@nmoinvaz
nmoinvaz / powershell-base64-thumbprint.md
Last active April 30, 2020 21:28
Using PowerShell to generate new code signing certificate with base64 thumbprint

To create the code signing certificate using PowerShell (using Administrator prompt):

$cert = New-SelfSignedCertificate -Subject "My Certificate" -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My -NotAfter (Get-Date).AddYears(100)

To export the certificate from the certificate store:

$certPassword = ConvertTo-SecureString -String "passwordhere" -Force –AsPlainText
$cert | Export-PfxCertificate -FilePath "mycert.pfx" -Password $certPassword

To get the base64 string of the SHA1 thumbprint of a PFX certificate use the following:

@nmoinvaz
nmoinvaz / settings.json
Last active August 13, 2019 23:08
Visual Studio Code Settings
{
"editor.fontSize": 12,
"editor.renderWhitespace": "all",
"breadcrumbs.enabled": true,
"workbench.colorTheme": "Atom One Dark",
"window.titleBarStyle": "custom",
"window.zoomLevel": -1,
"editor.minimap.enabled": false,
"python.pythonPath": "c:\\python27\\",
"terminal.explorerKind": "external",
@nmoinvaz
nmoinvaz / crc32c_sse.c
Last active July 22, 2019 16:49
CRC-32C with Intel SSE 4.2
/* crc32c_sse.c -- compute the CRC-32 of a data stream
* Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler
* Copyright (C) 2016 Yang Zhang
* Copyright (C) 2019 Nathan Moinvaziri
* For conditions of distribution and use, see copyright notice in zlib.h
*
*/
#ifdef X86_SSE4_2_CRC_HASH
#include <stdint.h>
@nmoinvaz
nmoinvaz / cxosxnotarize.md
Last active August 15, 2022 20:45
Cross-Platform macOS Notarization

Cross-Platform macOS Notarization

Requires cross-platform iTMSTransporter tool written in Java. The Transporter command line utility uploads app binaries to iTunes Connect. It uses third-party delivery methods called Signiant and Aspera.

https://itunesconnect.apple.com/transporter/1.9.8/iTMSTransporterToolInstaller_1.9.8.exe https://help.apple.com/itc/transporteruserguide/#/apdAbeb95d60

iTMSTransporter contains several jar files that can be run with Java. They have a self-update mechanism that will update to the latest version of iTMSTransporter.

  1. Create an iTunes Music Store Package (.itmsp directory)
@nmoinvaz
nmoinvaz / powershell-hex-thumbprint.md
Last active May 24, 2023 10:17
Using Powershell to get the Public Key in hex from a certificate

To retrieve the public key from a PFX certificate using Powershell, use the following command:

$publicKey = (Get-PfxCertificate -FilePath mycert.pfx).GetPublicKey()

To convert the public key to a hex string without hyphens you can use this command:

[System.BitConverter]::ToString($publicKey).Replace("-", "")
@nmoinvaz
nmoinvaz / codesign-ticket-fmt.md
Last active April 16, 2024 14:38
Apple MachO Code Signature Ticket Format

Apple MachO Code Signature with Ticket file format structure

  • Super blob (embedded signature = 0xfade0cc0)
    • Blob (code directory = 0xfade0c02)
      • Code signature (DER encoded)
    • Blob wrapper (fade0b01)
      • Length [4]
      • Offset [4]
      • Type? [4] = 256? (signature?)
  • Unknown [4] 239?
@nmoinvaz
nmoinvaz / pac-utils.h
Created May 13, 2019 16:20
Simple PAC JS utils
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://github.com/mozilla/gecko-dev/blob/master/netwerk/base/ProxyAutoConfig.cpp
// These are some global helper symbols the PAC format requires that we provide
// that are initialized as part of the global javascript context used for PAC
// evaluations. Additionally dnsResolve(host) and myIpAddress() are supplied in
// the same context but are implemented as c++ helpers. alert(msg) is similarly
@nmoinvaz
nmoinvaz / angular-ie8-shim.js
Created January 8, 2019 16:14
angular-ie8-shim
// AngularJS v1.4.7 ie8 build
// Source: https://github.com/fergaldoyle/angular.js-ie8-builds
(function () {
// detect IE8 one way or another
/*one way
var ie=function(){
for(var e,i=3,n=document.createElement("div"),t=n.getElementsByTagName("i");
n.innerHTML="<!--[if gt IE "+ ++i+"]><i></i><![endif]-->",t[0];);return i>4?i:e
@nmoinvaz
nmoinvaz / promise.finally.defer.polyfill.js
Last active August 2, 2018 16:49
Promise finally and defer polyfill
/**
* Promise.prototype.finally
*
* Pulled from https://github.com/domenic/promises-unwrapping/issues/18#issuecomment-57801572
* https://github.com/matthew-andrews/Promise.prototype.finally/blob/master/finally.js
* @author @stefanpenner, @matthew-andrews
*
* Promise.defer
*
* Pulled from http://bluebirdjs.com/docs/api/deferred-migration.html
@nmoinvaz
nmoinvaz / functions-everybody-else-notification.php
Last active October 11, 2018 05:23
Send emails to everybody else on a ticket
<?php
/**
* @package Awesome Support: Everybody Reply
* @author Nathan Moinvaziri <nathan@nathanm.com>
* @license MIT
* @link http://github.com/nmoinvaz/
* @copyright 2018 Nathan Moinvaziri
*
* @wordpress-plugin
* Plugin Name: Awesome Support: Everybody Reply