Skip to content

Instantly share code, notes, and snippets.


Tod Karpinski tkarpinski

View GitHub Profile
View ObsidianCode.dvtcolortheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>0 0 0 1</string>
<string>Menlo-Bold - 11.0</string>
<string>0 0 0 1</string>
tkarpinski / dfdexample.js
Created Jun 27, 2011
a sample ajax chunk request using deferreds
View dfdexample.js
var getAllObjects = function () {
var start = 0,
chunkSize = 2000,
dfd = $.Deferred(),
getChunk = function (start, chunkSize) {
return $.ajax({
url: '<requesturi>',
type: 'POST',
dataType: 'json',
data: JSON.stringify({ start: start, length: chunkSize }),
tkarpinski / gist:1105014
Created Jul 25, 2011
powershell profile script
View gist:1105014
#copy this file to C:\users\<username>\Documents\WindowsPowerShell
#clone posh-git to C:\users\<username>\projects
# Load posh-git example profile
. C:\users\<username>\projects\posh-git\profile.example.ps1
#Set environment variables for Visual Studio Command Prompt
pushd 'c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC'
cmd /c "vcvarsall.bat&set" |
foreach {
tkarpinski / template.js
Created Jan 4, 2012
template for js file using jslint and jquery namespace
View template.js
/// <reference path="jquery-1.7.1.js"/>
/// <reference path="jquery.namespace.js"/>
/*globals jQuery, window, document*/
///template for new js file in visual studio and jslint
my.namespace = (function () {
'use strict';
tkarpinski / gist:1649302
Created Jan 20, 2012
Return JsonResult from Exception on Controller
View gist:1649302
protected override void OnException(ExceptionContext filterContext)
filterContext.Result = Json(new { error = filterContext.Exception.ToString()},JsonRequestBehavior.AllowGet());
tkarpinski / CasseteConfiguration.cs
Created Feb 10, 2012
Cassette / SignalR integration
View CasseteConfiguration.cs
public class CassetteConfiguration : ICassetteConfiguration
public void Configure(BundleCollection bundles, CassetteSettings settings)
//Assuming that you've included the SignalR.Js nuget package this is how you configure
//cassette to correctly order your Scripts and your hub script generated by signalr
bundles.AddUrlWithAlias<ScriptBundle>("http://localhost:50436/signalr/hubs", "signalr-hub", b => { b.AddReference("~/Scripts"); });
tkarpinski / 1025charstring.txt
Created Mar 16, 2013
1025 char string - starts with 1, ends with 3, should exclude 3 if truncated at 1024 chars long
View 1025charstring.txt
View IdCodeStyleConventions.txt
Use real tabs that equal 4 spaces.
Use typically trailing braces everywhere (if, else, functions, structures, typedefs, class definitions, etc.)
if ( x ) {
tkarpinski / bigdata-log-query.sql
Last active Jan 7, 2017
Migrate Nearline Storage to Coldline storage for Arq Backup on Google Cloud
View bigdata-log-query.sql
MIN(cast(time_micros as timestamp)) as mi,
MAX(cast(time_micros as timestamp)) as ma,
COUNT(*) as ct,
FROM [{PROJECTNAME}:storageanalysis.usage]
--WHERE cs_user_agent = 'GCS Lifecycle Management' -- if you only want Lifecycle events
GROUP BY cs_bucket,cs_user_agent

Keybase proof

I hereby claim:

  • I am tkarpinski on github.
  • I am todkarpinski ( on keybase.
  • I have a public key ASAUNOlmtJmzY3G0Qo5hpwbJoLXIzzBNMHxi1jjNQ-xt3go

To claim this, I am signing this object: