Skip to content

Instantly share code, notes, and snippets.

Atif Aziz atifaziz

Block or report user

Report or block atifaziz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@atifaziz
atifaziz / git-aliases.txt
Last active Dec 12, 2019
My Git aliases
View git-aliases.txt
git config --global alias.aliases "config --get-regexp ^alias\."
git config --global alias.last "log -1 HEAD"
git config --global alias.ls "log --decorate --pretty=format:%Cgreen%h%Cred%d%Creset\ %s\ [%an]"
git config --global alias.ll "log --pretty=fuller"
git config --global alias.st "status"
git config --global alias.diffc "diff --cached"
git config --global alias.ci "commit"
git config --global alias.cia "commit --amend"
git config --global alias.mff "merge --ff-only"
git config --global alias.mt "mergetool"
@atifaziz
atifaziz / json.vbs
Last active Nov 29, 2019
JSON Encoder for VBScript
View json.vbs
'==========================================================================
' JSON Encoder for VBScript
' Copyright (c) 2013 Atif Aziz. All rights reserved.
'
' Licensed under the Apache License, Version 2.0 (the "License");
' you may not use this file except in compliance with the License.
' You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
@atifaziz
atifaziz / TaskWhenAll.cs
Last active Nov 12, 2019
Implementation of Task.WhenAll in C# and F#
View TaskWhenAll.cs
// http://msdn.microsoft.com/en-us/library/system.threading.tasks.task.whenall.aspx
using System;
using System.Threading;
using System.Threading.Tasks;
static class TaskExtensions
{
public static Task<T[]> WhenAll<T>(this Task<T>[] tasks)
{
@atifaziz
atifaziz / Program.cs
Last active Sep 28, 2019
Simple NDde demo for reading and writing data to Excel using DDE
View Program.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NDde.Client;
// Adapted from: http://ndde.codeplex.com/discussions/399046
static class Program
{
@atifaziz
atifaziz / Export-ExcelProject.ps1
Last active Sep 26, 2019
PowerShell script to export VBA project components (classes, modules, etc.) from an Excel workbook
View Export-ExcelProject.ps1
# Copyright (c) 2014 Atif Aziz. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
View System.Management.Automation.TypeAccelerators.csv
Accelerator Type
adsi System.DirectoryServices.DirectoryEntry
adsisearcher System.DirectoryServices.DirectorySearcher
Alias System.Management.Automation.AliasAttribute
AllowEmptyCollection System.Management.Automation.AllowEmptyCollectionAttribute
AllowEmptyString System.Management.Automation.AllowEmptyStringAttribute
AllowNull System.Management.Automation.AllowNullAttribute
ArgumentCompleter System.Management.Automation.ArgumentCompleterAttribute
array System.Array
bigint System.Numerics.BigInteger
@atifaziz
atifaziz / Unprotect-ProtectedData.ps1
Created Mar 31, 2017
Decrypting DPAPI-protected Base64 data from PowerShell
View Unprotect-ProtectedData.ps1
Add-Type -AssemblyName System.Security;
[Text.Encoding]::ASCII.GetString([Security.Cryptography.ProtectedData]::Unprotect([Convert]::FromBase64String((type -raw (Join-Path $env:USERPROFILE foobar))), $null, 'CurrentUser'))
@atifaziz
atifaziz / md5.cmd
Last active Jul 16, 2019
Windows batch script to compute MD5 hash of a file using PowerShell
View md5.cmd
@echo off
if "%1"=="" echo Missing file specification>&2 & exit /b 1
PowerShell -C "[System.BitConverter]::ToString([System.Security.Cryptography.MD5]::Create().ComputeHash([System.IO.File]::ReadAllBytes('%1'))).ToLowerInvariant().Replace('-', '') + ' ' + '%~f1'"
@atifaziz
atifaziz / md5.cs
Created Dec 24, 2012
C# program to compute MD5 hash of files specified as command-line arguments
View md5.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
static class Program
{
static void Run(IEnumerable<string> args)
@atifaziz
atifaziz / clang-llvm-wasm-wasi.md
Created Jun 14, 2019
Compiling C to WebAssembly using Clang/LLVM & WASI
View clang-llvm-wasm-wasi.md

Compiling C to WebAssembly using Clang/LLVM & WASI

These are my notes. See also “[Compiling C to WebAssembly using clang/LLVM and WASI][fda]” by [Frank Denis], which was my starting point.

Assume the following example program in a file called example.c:

#include <stdio.h>
You can’t perform that action at this time.