Skip to content

Instantly share code, notes, and snippets.

View aaronhoffman's full-sized avatar

Aaron Hoffman aaronhoffman

View GitHub Profile
@aaronhoffman
aaronhoffman / quandl-eod-stock-price-meta-data.csv
Created November 7, 2017 19:04
Quandl Historical NYSE Symbol Stock Price Data -- Wiki EOD Stock Prices API
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
aaronhoffman / AesKeyGenerator.cs
Last active October 15, 2019 21:19
Generate Random AES Encryption Key
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];
random.GetBytes(keyArray);
var base64key = Convert.ToBase64String(keyArray);
@aaronhoffman
aaronhoffman / AuthenticationMiddleware.cs
Last active July 3, 2017 13:54
asp.net core AuthenticationMiddleware Dependency Injection
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
aaronhoffman / pre-commit
Created April 14, 2017 15:25
git hooks - prevent commit to local master branch and prevent push to remote master branch
#!/bin/sh
# 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
fi
exit 0
@aaronhoffman
aaronhoffman / git-bc.cmd
Created March 2, 2017 02:50
Configure Beyond Compare 4 as git diff tool on windows 10
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
aaronhoffman / iphone-text-message-sqlite.sql
Last active May 1, 2025 13:26
SQLite SQL Query for iPhone Text Message Backup
-- more info http://aaron-hoffman.blogspot.com/2017/02/iphone-text-message-sqlite-sql-query.html
select
m.rowid
,coalesce(m.cache_roomnames, h.id) ThreadId
,m.is_from_me IsFromMe
,case when m.is_from_me = 1 then m.account
else h.id end as FromPhoneNumber
,case when m.is_from_me = 0 then m.account
else coalesce(h2.id, h.id) end as ToPhoneNumber
,m.service Service
@aaronhoffman
aaronhoffman / keybase.md
Created February 9, 2017 14:26
keybase.md

Keybase proof

I hereby claim:

  • I am aaronhoffman on github.
  • I am aaronhoffman (https://keybase.io/aaronhoffman) on keybase.
  • I have a public key whose fingerprint is CA49 A892 C3FF 3F8B 95B4 8309 B693 4228 86D5 7E4F

To claim this, I am signing this object:

@aaronhoffman
aaronhoffman / KuduWebJobService.cs
Last active October 30, 2020 13:40
Start and Stop Azure WebJobs via the Kudu REST API
public class KuduWebJobService
{
private string KuduUserName { get; set; }
private string KuduPassword { get; set; }
private string AzureWebsiteName { get; set; }
public KuduWebJobService()
{
this.KuduUserName = "";
this.KuduPassword = "";
@aaronhoffman
aaronhoffman / email-to-sms.csv
Created January 18, 2017 22:15
Map of Email to SMS Text Message For Major US Cell Phone Carriers
provider emailDomain
AT&T txt.att.net
Verizon vtext.com
US Cellular email.uscc.net
Sprint messaging.sprintpcs.com
T-Mobile tmomail.net
@aaronhoffman
aaronhoffman / ky-county-district-map.csv
Created November 11, 2016 22:53
Kentucky United States Congressional District County Map Crosswalk
CountyName District
Adair KY1
Allen KY1
Anderson KY6
Ballard KY1
Barren KY2
Bath KY4
Bell KY5
Boone KY4
Bourbon KY6