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 / flickr-scraper.py
Last active August 7, 2021 11:30 — forked from ralphbean/flickr-scraper.py
Script to scrape images from a flickr account.
#!/usr/bin/env python
""" Script to scrape images from a flickr account.
Author: Ralph Bean <rbean@redhat.com>
Added ability to get specific image sizes
Added thread pooling for faster retrieval of large sets of images
Added flickr api request caching for faster recovery
Author: Nathan Moinvaziri <nathan@nathanm.com>
"""
@nmoinvaz
nmoinvaz / convertguid.ps1
Created June 4, 2018 19:49
Powershell function to convert GUID string to static GUID
function ConvertGuidStringToStaticGuid($GuidString)
{
$g = [Guid]$GuidString
"{ " +
(@([BitConverter]::ToInt32(($g.ToByteArray() | Select -First 4),0),
[BitConverter]::ToInt16(($g.ToByteArray() | Select -Index (4..5)),0),
[BitConverter]::ToInt16(($g.ToByteArray() | Select -Index (6..7)),0)
) | ForEach-Object { "0x" + $_.ToString("x2").ToUpper() + "," }) +
" { 0x" +
[System.String]::Join(", 0x",
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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>