Skip to content

Instantly share code, notes, and snippets.

View sirkirby's full-sized avatar
:octocat:

Chris Kirby sirkirby

:octocat:
View GitHub Profile
@sirkirby
sirkirby / debugoff-web.xml
Last active August 29, 2015 13:56
turn debug off to get bundling and minification in release mode locally
<!-- bundling and minification will only kick off when debug='false' is set. this tells the runtime that you're in a release environment -->
<compilation debug="false" targetFramework="4.5" />
@sirkirby
sirkirby / hipchat-api-post.js
Last active August 29, 2015 14:01
Azure mobile service custom api post kudu payload to hipchat
exports.post = function(request, response) {
console.log(request.body); // for debugging
var hipchat = require('node-hipchat');
var hipClient = new hipchat('myV1APIKey');
var color = "green"; // default to success color
var message = "Kudu deployment to <strong>" + request.body.siteName + "</strong> (" + request.body.deployer + ") triggered by <strong>" + request.body.author + "</strong>";
if (request.body.status === "success") {
message += " was successful!";
@sirkirby
sirkirby / kudu-postdeployment.json
Last active August 29, 2015 14:01
Kudu PostDeployment event payload
{
"id": "005c554bbeeaac0000000000000000000000",
"status": "success",
"statusText": "",
"authorEmail": "[email protected]",
"author": "Chris Kirby",
"message": "my last commit message",
"progress": "",
"deployer": "who triggered the deployment",
"receivedTime": "2014-05-12T23:45:17.4767323Z",
@sirkirby
sirkirby / trycatch-raygun.cs
Last active August 29, 2015 14:02
try catch example using the raygun.diagnostics custom trace listener
try {}
catch (Exception e)
{
// any arg of type IList<string> will be treated as tags and any type of IDictionary will be treated as custom data
// any arg of type Exception will be wrapped in the primary raygun exception object
var customData = new Dictionary<string, object> {{"myType", someObject};
var tags = new List<string> { "tag1", "tag1" };
Trace.TraceError("Something bad happened", e, tags, customData);
// or inline with arg just added to a default Dictionary<object, object> object
Trace.TraceError("something bad happened", e, new List<string> {"tag1"}, someParameter, someObject);
protected virtual MessageContext MessageFromTraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string message, params object[] args)
{
var context = new MessageContext(new Exception(message), new List<string>(), new Dictionary<object, object>());
if (args != null)
{
var localArgs = args.ToList();
// check the args for custom data
var custom = localArgs.FirstOrDefault(a => a is IDictionary);
if (custom != null)
@sirkirby
sirkirby / msbuild-deploy.cmd
Created August 10, 2014 00:17
command line arguments passed to msbuild for azure websites deployment
/p:Configuration=Debug /p:DeployOnBuild=True /p:PublishProfile="NameOfPublishProfile" /p:ProfileTransformWebConfigEnabled=False /p:Password=PasswordFromPublishProfile /p:AllowUntrustedCertificate=true
@sirkirby
sirkirby / bamboo-nuget-pkg-restore.cmd
Created August 10, 2014 01:02
bamboo script task nuget package restore
:: use the nuget.exe from your repository with your custom nuget.config
"${bamboo.build.working.directory}/tools/nuget/nuget.exe" restore "${bamboo.build.working.directory}/src/MySolution.sln" ^
-ConfigFile "${bamboo.build.working.directory}/tools/nuget/nuget.config"
@sirkirby
sirkirby / sql-azure-index-tuning.sql
Last active August 29, 2015 14:07
sql azure index suggestions
SELECT CONVERT (varchar, getdate(), 126) AS runtime,
mig.index_group_handle, mid.index_handle,
CONVERT (decimal (28,1), migs.avg_total_user_cost * migs.avg_user_impact *
(migs.user_seeks + migs.user_scans)) AS improvement_measure,
'CREATE INDEX missing_index_' + CONVERT (varchar, mig.index_group_handle) + '_' +
CONVERT (varchar, mid.index_handle) + ' ON ' + mid.statement + '
(' + ISNULL (mid.equality_columns,'')
+ CASE WHEN mid.equality_columns IS NOT NULL
AND mid.inequality_columns IS NOT NULL
THEN ',' ELSE '' END + ISNULL (mid.inequality_columns, '')
@sirkirby
sirkirby / stash-webhook-to-slack.js
Created October 11, 2014 01:01
process a stash webhook and post to slack
var issues;
exports.post = function(request, response) {
var rep = request.body.repository;
var ref = request.body.refChanges;
var ch = request.body.changesets;
// let me specify the destination and noise level via the query string
var channel = "#devops";
if (request.query.channel != undefined && request.query.channel != null)
@sirkirby
sirkirby / teamcity-webhook-to-slack.js
Created October 11, 2014 01:11
process a team city webhook and post to slack
exports.post = function(request, response) {
var p = request.body;
var Slack = require('slack-node');
var slack = new Slack("[mywebhookskey]", "[myteamname]");
// let me specify the destination and noise level via the query string
var channel = "#devops";
if (request.query.channel != undefined && request.query.channel != null)
channel = request.query.channel;