Skip to content

Instantly share code, notes, and snippets.

@johndobrien
johndobrien / gist:11008731
Created April 17, 2014 20:10
PostSharp Aspect for Metrics
using System;
using System.Diagnostics;
using System.Reflection;
using PostSharp.Aspects;
using PostSharp.Extensibility;
namespace Common.Metrics
{
[Serializable]
[MulticastAttributeUsage(MulticastTargets.Method)]
@johndobrien
johndobrien / gist:11008774
Created April 17, 2014 20:11
Statsd metrics
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using Common.Logging;
namespace Common.Metrics
WITH DeptList AS
(select rbc.RbcId as GroupId, CAST(NULL as BIGINT) as ParentId, d.DepartmentId, d.Description, CAST(g.Name as VARCHAR(MAX)) as Name, 1 as level
from relationship r1
INNER JOIN Rbc rbc ON r1.RightId = rbc.RbcId
INNER JOIN Department d on r1.LeftId=d.DepartmentId
INNER JOIN [Group] g on d.DepartmentId=g.GroupId
where r1.RelationshipTypeId = 2
UNION ALL
select DL.GroupId, p.DepartmentId ParentId, c.DepartmentId, c.Description, CAST(DL.Name + '>' + g.Name as VARCHAR(MAX)) as Name, DL.level + 1
from relationship r2
@johndobrien
johndobrien / sweet_potato_chili.md
Created February 15, 2016 14:31
Sweet Potato Chili

Fresh

  • 4 cups sweet potato, roughly diced (I buy a bag and call it good)
  • 1 large Haas avocado, sliced or cubed
  • 1 medium red onion, roughly chopped
  • 2 cloves garlic, minced
  • OPTIONAL 1 chipotle pepper en adobo, chopped finely
  • OPTIONAL shredded cheddar cheese

Pantry

  • 2 cans of unsalted black beans
sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-setuptools python-virtualenv python-dev libpq-dev libxml2-dev libxslt-dev openssl libffi-dev
sudo apt-get install redis-server
sudo mkdir /var/www
sudo adduser sentry
sudo chown sentry:sentry /var/www
sudo su - sentry
virtualenv /var/www/sentry
/***********************************************
* Removes outdated properties from RL mongodb
*
* Run the following on the command line:
* mongo localhost:27017/recovery_library_development cleanup_rl.js
************************************************/
db.content.update({}, {$unset: {latest: ""}},{multi: true});
db.content.update({}, {$unset: {'liker_ids': ""}},{multi: true});
db.content.update({}, {$unset: {'disliker_ids': ""}},{multi: true});
@johndobrien
johndobrien / test.cd
Created August 19, 2017 20:01
Testing SMTP
DotNetOpenMailProvider provider = new DotNetOpenMailProvider();
NameValueCollection configValue = new NameValueCollection();
configValue["smtpServer"] = "127.0.0.1";
configValue["port"] = "8081";
provider.Initialize("providerTest", configValue);
TestSmtpServer receivingServer = new TestSmtpServer();
try
{
receivingServer.Start("127.0.0.1", 8081);