Skip to content

Instantly share code, notes, and snippets.

View timabell's full-sized avatar
🍵
418 I'm a teapot

Tim Abell timabell

🍵
418 I'm a teapot
View GitHub Profile
// method to add to dbcontext
/// <summary>
/// Set EF's OriginalValue of RowVersion for 'entity' to the supplied value.
/// This allows you to make use of EF's built-in concurrent-editing
/// when you don't have the entity as it was presented to the user to
/// edit (because of the stateless nature of the web).
/// Call this before SaveChanges to ensure concurrent edits don't go
/// unnoticed by users.
/// More info: http://stackoverflow.com/a/9190378/10245
@timabell
timabell / cull-remote-branches.sh
Last active July 16, 2016 07:54
delete all but the specified branches on the remote, useful after a github fork of a repo with many branches you don't care about
git branch -r |grep timabell| egrep -v "master|gh-pages|things|to|leave"| sed 's/.*\// :/'|xargs git push timabell
declare @prefix varchar = 'MyApp_'
select
tbl.name [table],
col.name [column],
ep.name,
ep.value [value]
from sys.extended_properties ep
inner join sys.objects tbl on tbl.object_id = ep.major_id
left outer join sys.columns col on col.object_id = ep.major_id and col.column_id = ep.minor_id
where ep.name like @prefix + '%'
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\SshHostKeys]
"rsa2@22:github.com"="0x23,0xab603b8511a67679bdb540db3bd2034b004ae936d06be3d760f08fcbaadb4eb4edc3b3c791c70aae9a74c95869e4774421c2abea92e554305f38b5fd414b3208e574c337e320936518462c7652c98b31e16e7da6523bd200742a6444d83fcd5e1732d03673c7b7811555487b55f0c4494f3829ece60f94255a95cb9af537d7fc8c7fe49ef318474ef2920992052265b0a06ea66d4a167fd9f3a48a1a4a307ec1eaaa5149a969a6ac5d56a5ef627e517d81fb644f5b745c4f478ecd082a9492f744aad326f76c8c4dc9100bc6ab79461d2657cb6f06dec92e6b64a6562ff0e32084ea06ce0ea9d35a583bfb00bad38c9d19703c549892e5aa78dc95e250514069"
"rsa2@22:gist.github.com"="0x23,0xab603b8511a67679bdb540db3bd2034b004ae936d06be3d760f08fcbaadb4eb4edc3b3c791c70aae9a74c95869e4774421c2abea92e554305f38b5fd414b3208e574c337e320936518462c7652c98b31e16e7da6523bd200742a6444d83fcd5e1732d03673c7b7811555487b55f0c4494f3829ece60f94255a95cb9af537d7fc8c7fe49ef318474ef2920992052265b0a06ea66d4a167fd9f3a48a1a4a307ec1eaaa5149a969a6ac5d56a5ef627e51
@timabell
timabell / sourced.ai spam.md
Last active December 8, 2016 15:57
unsolicited mail by farming my OSS publications. douchebags.

completely irrelevant, if they'd bothered to actually look they'd have known that. reading github doesn't make your automated spam bullshit any more acceptable. wankers.

Oh and pick one domain and stick to it ffs. Idiots. Which is it, http://sourced.ai/ or http://sourced.tech/

I don't mind people (humans) reading my published stuff and contacting my personally, but the below is unacceptable.

From your webshite:

We send highly relevant job proposals to the suggested profiles and inform them about all the aspects of the position.

@timabell
timabell / azure-boxstarter.txt
Last active November 19, 2015 15:56
boxstarter for an azure vm that already had vs2015 on it
# boxstarter script http://boxstarter.org/
# source: https://gist.github.com/timabell/e1d9def6ca38d9ebee5c
# based on: https://gist.github.com/timabell/608fb680bfc920f372ac
# originally tested on win7 x64
# wip on win 8.1 build
# To run, paste this into internet explorer's address bar (doen't work in firefox) and hit enter:
# http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/timabell/e1d9def6ca38d9ebee5c/raw/azure-boxstarter.txt
# If IE is your default browser you can simply paste into start > run without firing up IE first.
#!/bin/bash
#
# Compare two PDF files.
# Dependencies:
# - pdfinfo (xpdf)
# - pdfjam (texlive-extra-utils)
# - diffpdf
#
MAX_HEIGHT=15840 #The maximum height of a page (in points), limited by pdfjam.
--------- beginning of crash
E/AndroidRuntime( 3617): FATAL EXCEPTION: AsyncHandler
E/AndroidRuntime( 3617): Process: com.android.deskclock, PID: 3617
E/AndroidRuntime( 3617): android.database.sqlite.SQLiteException: Can't downgrade database from version 11 to 7
E/AndroidRuntime( 3617): at android.database.sqlite.SQLiteOpenHelper.onDowngrade(SQLiteOpenHelper.java:360)
E/AndroidRuntime( 3617): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:254)
E/AndroidRuntime( 3617): at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:187)
E/AndroidRuntime( 3617): at com.android.deskclock.provider.ClockProvider.query(Unknown Source)
E/AndroidRuntime( 3617): at android.content.ContentProvider.query(ContentProvider.java:1000)
E/AndroidRuntime( 3617): at android.content.ContentProvider$Transport.query(ContentProvider.java:214)

reposted here because the forum is a piece of shit and wouldn't let me post it. ~~

Hi, I've spent all day trying to get to the bottom of this with no luck so am reaching out for help.

I've just bought a galaxy s5 brand-new. Got it home, wiped it and flashed it with TWRP & CM 12.1. This worked fine and the phone behaves and is usable.

However; when I turn on encryption the phone encrypts the partition, reboots automatically and then never gets past the cyanogen logo and just sits there (left it overnight to see, was still stuck in the morning). I've tried several times, with/without adb/root enabled, and with/without connecting to the wireless lan.

@timabell
timabell / diamond FK enforcement.sql
Last active September 28, 2015 04:14
get routes through a sql server fk structure - http://sqlfiddle.com/#!6/4364c/5

-- idea for making sure that diamond shaped relationships stay within the same parent
/*
-- what the diamond should like like
___ middleA-1 ___
/ \
parent-1 - - chiild-1
\ /