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 / 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 / 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
@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 / 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 / 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 / compare258.txt
Created February 22, 2020 04:31
zlib compare258 results
len: 0
compare258 average ms: 1
compare258_unaligned_16 average ms: 1
compare258_unaligned_32 average ms: 1
compare258_unaligned_64 average ms: 1
compare258_unaligned_128 average ms: 1
len: 1
compare258 average ms: 1
compare258_unaligned_16 average ms: 1
compare258_unaligned_32 average ms: 1

pigzCustom.exe is built off nmoinvaz/zlib-ng branch improvements/update-hash-v3.

(base) C:\Users\nathan\Source\pigz-bench-python>python ./b_speed_threads.py
Skipping test: Unable to find "gzip"
exe     level   ms      mb/s    %       threads
pigzCloudflare.exe      3       416     138     47.30   0
pigzCloudflare.exe      6       552     104     46.68   0
pigzCloudflare.exe      9       771     74      46.60   0
pigzCloudflare.exe      3       1842    31      47.31   1
@nmoinvaz
nmoinvaz / compare258_results.md
Last active March 29, 2020 18:55
compare_258_results.md

pigznmoinvaz.exe is built off nmoinvaz/zlib-ng branch improvements/compare-258.

(base) PS E:\pigz-bench-python> python .\b_speed_threads.py
Skipping test: Unable to find "gzip"
exe     level   ms      mb/s    %       threads
pigzCloudflare.exe      3       212     270     47.30   0
pigzCloudflare.exe      6       281     203     46.68   0
pigzCloudflare.exe      9       408     140     46.60   0
pigzCloudflare.exe      3       778     74      47.31   1