Skip to content

Instantly share code, notes, and snippets.


Aaron Hoffman aaronhoffman

View GitHub Profile
aaronhoffman / iphone-text-message-sqlite.sql
Last active Jul 20, 2020
SQLite SQL Query for iPhone Text Message Backup
View iphone-text-message-sqlite.sql
-- more info
,coalesce(m.cache_roomnames, ThreadId
,m.is_from_me IsFromMe
,case when m.is_from_me = 1 then m.account
else end as FromPhoneNumber
,case when m.is_from_me = 0 then m.account
else coalesce(, end as ToPhoneNumber
,m.service Service
View RedditOAuthApiController.cs
public ActionResult StartOAuth()
var redditOAuthAuthorizeUri = "";
var redditOAuthRedirectUri = "https://localhost:44399/RedditRedirectUri"; // your redirect uri
var redditOAuthScopes = ""; // ex: "identity,history" scope param
var redditClientId = ""; // from app:
var oauthState = Guid.NewGuid(); // used to uniquely identify this request
// todo: store oauthState somewhere...
aaronhoffman / message.txt
Created Dec 5, 2017
keybase just for fun
View message.txt
Hash: SHA512
keybase is fun!
Version: Keybase OpenPGP v2.0.76
aaronhoffman / git-bc.cmd
Created Mar 2, 2017
Configure Beyond Compare 4 as git diff tool on windows 10
View git-bc.cmd
git config --global diff.tool bc
git config --global difftool.bc.path "C:\Program Files\Beyond Compare 4\BComp.exe"
git config --global merge.tool bc
git config --global mergetool.bc.path "C:\Program Files\Beyond Compare 4\BComp.exe"
git config --global alias.mydiff "difftool --dir-diff --tool=bc --no-prompt"
aaronhoffman / pre-commit
Created Apr 14, 2017
git hooks - prevent commit to local master branch and prevent push to remote master branch
View pre-commit
# prevent commit to local master branch
branch=`git symbolic-ref HEAD`
if [ "$branch" = "refs/heads/master" ]; then
echo "pre-commit hook: Can not commit to the local master branch."
exit 1
exit 0
aaronhoffman / 20200213083642_InitialIdentityServerConfigurationDbMigration.Designer.cs
Last active Feb 13, 2020
IdentityServer Configuration SQL Tables EF Migration Issue
View 20200213083642_InitialIdentityServerConfigurationDbMigration.Designer.cs
// <auto-generated />
using System;
using IdentityServer4.EntityFramework.DbContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace SqlServer.Data.Migrations.IdentityServer.ConfigurationDb
aaronhoffman / RSACryptoServiceProviderHelper.cs
Created Feb 11, 2020
Convert RSACryptoServiceProvider ToXmlString RsaXML W3C XKMS format to Public Private key PEM base64 string
View RSACryptoServiceProviderHelper.cs
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
public class RSACryptoServiceProviderHelper
// code from here:
// -
// -
aaronhoffman / AesKeyGenerator.cs
Last active Oct 15, 2019
Generate Random AES Encryption Key
View AesKeyGenerator.cs
public static class AesKeyGenerator
public static string GenerateKey(int bitStrength)
// note: valid bit strength for aes: 128, 192, or 256 bits (16, 24, or 32 bytes)
var random = new System.Security.Cryptography.RNGCryptoServiceProvider();
var keyArray = new byte[bitStrength / 8];
var base64key = Convert.ToBase64String(keyArray);
aaronhoffman / TileSystem.cs
Created May 26, 2016
Convert WGS84, latitude, longitude, to Web Mercator, Google Maps, Bing Maps, Pixel Coordinates
View TileSystem.cs
// source:
// <copyright company="Microsoft">
// Copyright (c) 2006-2009 Microsoft Corporation. All rights reserved.
// </copyright>
using System;
using System.Text;
aaronhoffman /
Last active Sep 23, 2019
hacker news firebase download
# generate file containing all URIs to execute to retrieve data from hacker news firebase API
# api docs:
echo generating file hn-uri.txt
echo file will contain $URICOUNT lines
You can’t perform that action at this time.