Skip to content

Instantly share code, notes, and snippets.

@Romiko
Romiko / PowerscribeStatus.cs
Created August 1, 2014 01:15
PowerscribeStatus
namespace Powerscribe.Client
{
public enum PowerscribeStatus
{
/// <summary>
/// Specifies that a report was created and then discarded.
/// </summary>
Discarded = -1,
/// <summary>
@Romiko
Romiko / KillProcesses.cs
Last active August 29, 2015 14:04
Kill Process for current user
public static void KillProcesses(string processName, bool currentUserOnly, Process excludeMe = null)
{
var processes = new ManagementObjectSearcher(string.Format("SELECT * FROM Win32_Process WHERE Name='{0}'", processName)).Get();
foreach (var o in processes)
{
var process = (ManagementObject)o;
var processId = int.Parse(process["ProcessId"].ToString());
if (process["ExecutablePath"] == null) continue;
if (excludeMe != null && processId == excludeMe.Id) continue;
var ownerInfo = new object[2];
@Romiko
Romiko / DicomQueryManager.cs
Last active August 29, 2015 14:03
DICOM Query Wrapper
using System;
using System.Linq;
using DicomObjects;
using DicomObjects.Enums;
namespace Dicom
{
public class DicomQueryManager : IDicomQueryManager
{
public string CurrentServer { get; set; }
Write "Installing NServiceBus License"
$content = [xml]"<?xml version=`"1.0`" encoding=`"utf-8`"?>
<license id=`"MyId`" expiration=`"2114-06-11T04:13:03.9080905`" type=`"Standard`" ProductName=`"Royalty Free Platform License`" WorkerThreads=`"Max`" LicenseVersion=`"5.0`" MaxMessageThroughputPerSecond=`"Max`" AllowedNumberOfWorkerNodes=`"Max`" UpgradeProtectionExpiration=`"2015-06-11`" Applications=`"ServiceInsight;NServiceBus;ServicePulse;ServiceMatrix;ServiceControl;`" LicenseType=`"Royalty Free Platform License`" Edition=`"Enterprise `" Quantity=`"2`" Perpetual=`"`">
<name>MyName</name>
<Signature xmlns=`"http://www.w3.org/2000/09/xmldsig#`">
<SignedInfo>
<CanonicalizationMethod Algorithm=`"http://www.w3.org/TR/2001/REC-xml-c14n-20010315`" />
<SignatureMethod Algorithm=`"http://www.w3.org/2000/09/xmldsig#rsa-sha1`" />
<Reference URI=`"`">
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET NOCOUNT ON
GO
IF (OBJECT_ID('RebuildIndexes') IS NOT NULL)
DROP PROCEDURE RebuildIndexes
GO
@Romiko
Romiko / s3_website_push_error
Created August 4, 2013 09:13
s3_website push error
3_website push
Deploying _site/* to blog.rangerrom.com
Calculating diff //Users/romikoderbynew/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/openssl/buffering.rb:174:in `sysread_nonblock': end of file reached (EOFError)
from /Users/romikoderbynew/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/openssl/buffering.rb:174:in `read_nonblock'
from /Users/romikoderbynew/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/protocol.rb:141:in `rbuf_fill'
from /Users/romikoderbynew/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
from /Users/romikoderbynew/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
from /Users/romikoderbynew/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line'
from /Users/romikoderbynew/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:2552:in `read_new'
from /Users/romikoderbynew/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:1320:in `block in transport_request'
using System.Security.Permissions;
using System.Web.Mvc;
using MyStory.Logic.Security;
using MyStory.Web.Models;
using MyStory.Web.Models.Clients;
namespace MyStory.Web.Areas.Agency.Controllers
{
public partial class ClientController
{
@Romiko
Romiko / DeleteReferrals.cs
Created February 10, 2012 03:18
Delete Duplicate Referrals based on latest date initiated
private void DeleteLatestDuplicateReferrals(IList<Node<Referral>> duplicateReferrals)
{
var theReferralsToDelete = from r in duplicateReferrals
group r by r.Data.UniqueId
into g
where g.Count() > 1
select new
{
UniqueId = g.Key,
DateIntiated = (from r in g select r.Data.DateInitiatedUtc).Max(),
@Romiko
Romiko / ServiceDefinition.perf.csdef
Created February 9, 2012 03:34
Service Definition Transform
<?xml version="1.0"?>
<sd:ServiceDefinition name="Neo4j.Azure.Server"
xmlns:sd="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"
xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<sd:WebRole name="Web" xdt:Locator="Match(name)">
<sd:Startup>
<sd:Task commandLine="Startup.cmd" xdt:Locator="Match(commandLine)">
<sd:Environment>
<sd:Variable xdt:Transform="Replace" xdt:Locator="Match(name)" name="MYSTORYENV" value="PERF"/>
</sd:Environment>
@Romiko
Romiko / AzureStartUptask.xml
Created February 8, 2012 23:01
Windows Azure Startup Tasks
<WebRole name="Web" vmsize="Medium">
<Runtime executionContext="elevated" />
<Startup>
<Task commandLine="Startup.cmd" executionContext="elevated" taskType="background">
<Environment>
<Variable name="EMULATED">
<RoleInstanceValue xpath="/RoleEnvironment/Deployment/@emulated" />
</Variable>
</Environment>
</Task>