Skip to content

Instantly share code, notes, and snippets.


Aaron Hoffman aaronhoffman

View GitHub Profile
aaronhoffman / GoogleContactService.cs
Last active Aug 1, 2018
Google Contacts API Create New Contact in My Contacts System Group. more:
View GoogleContactService.cs
public class GoogleContactService
public void CreateContact()
var cr = this.CreateContactsRequest();
var groups = cr.GetGroups().Entries.ToList();
var myContactsSystemGroup = groups.FirstOrDefault(x => x.SystemGroup == "Contacts");
var newContact = new Contact();
aaronhoffman / convert-hashbytes-varbinary-hex-char.sql
Last active Dec 13, 2017
Convert SQL hashbytes varbinary to hex char
View convert-hashbytes-varbinary-hex-char.sql
convert(char(48), HASHBYTES('sha1', @HashInput), 2)
convert(char(64), HASHBYTES('sha2_256', @HashInput), 2)
aaronhoffman / INotifyPropertyChangedExtensions.cs
Last active Dec 6, 2017
Visual Studio 2017 Code Snippet INotifyPropertyChanged
View INotifyPropertyChangedExtensions.cs
public static void OnPropertyChanged<T>(
this INotifyPropertyChanged @this,
PropertyChangedEventHandler propertyChanged,
Expression<Func<T>> propertyExpr)
if (propertyChanged == null) return;
var memberExpr = (MemberExpression)propertyExpr.Body;
var ea = new PropertyChangedEventArgs(memberExpr.Member.Name);
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 / quandl-eod-stock-price-meta-data.csv
Created Nov 7, 2017
Quandl Historical NYSE Symbol Stock Price Data -- Wiki EOD Stock Prices API
View quandl-eod-stock-price-meta-data.csv
ticker min_date max_date
A 1999-11-18 2017-11-06
AA 2016-11-01 2017-11-06
AAL 2005-09-27 2017-11-06
AAMC 2012-12-13 2017-11-06
AAN 1984-09-07 2017-11-06
AAOI 2013-09-26 2017-11-06
AAON 1992-12-16 2017-11-06
AAP 2001-11-29 2017-11-06
AAPL 1980-12-12 2017-11-06
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 / AuthenticationMiddleware.cs
Last active Jul 3, 2017 core AuthenticationMiddleware Dependency Injection
View AuthenticationMiddleware.cs
public class MyAuthenticationMiddleware : AuthenticationMiddleware<MyAuthenticationOptions>
public MyAuthenticationMiddleware(
IMyService myService, // inject service here?? (via Startup.ConfigureServices(), services.AddTransient() )
RequestDelegate next,
IOptions<MyAuthenticationOptions> options,
ILoggerFactory loggerFactory,
UrlEncoder encoder)
: base(next, options, loggerFactory, encoder)
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 / 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 / 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
You can’t perform that action at this time.