Skip to content

Instantly share code, notes, and snippets.

@jaysonrowe
jaysonrowe / gmail_test.py
Created November 12, 2012 03:15
Checking Gmail with Selenium Webdriver in Python
#! /usr/bin/env python
import unittest
from selenium import webdriver
class TestGmail(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
@jaysonrowe
jaysonrowe / caloriecalc.cs
Created September 27, 2012 03:15
caloriecalc.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@jaysonrowe
jaysonrowe / EncryptorMainWindow.xaml.cs
Created September 23, 2012 21:40
Encryptor Main Window Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
@jaysonrowe
jaysonrowe / EncryptorMainWindow.xaml.xml
Created September 23, 2012 21:39
Main Window XAML
<Window x:Class="MD5Util.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MD5 Encryptor" Height="200" Width="375">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="91*"/>
<ColumnDefinition Width="251*"/>
</Grid.ColumnDefinitions>
<Label Content="Clear Text" HorizontalAlignment="Left" Margin="22,28,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.368,0"/>
@jaysonrowe
jaysonrowe / Encryptor.cs
Created September 23, 2012 21:37
Class to generate MD5 hash of string
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
namespace MD5Util
{
public class Encryptor
@jaysonrowe
jaysonrowe / TopShelfProgram.cs
Created September 20, 2012 02:01
TopShelf Program.cs
using System;
using System.Configuration;
using System.IO;
using System.Security.Permissions;
using System.Collections.Generic;
using System.Data;
using System.Text;
using Topshelf;
using Microsoft.SqlServer.Management.Smo;
@jaysonrowe
jaysonrowe / TopShelfStart.cs
Created September 20, 2012 01:56
TopShelf Start Method
public void Start()
{
try
{
watcher.Path = watcherpath;
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
watcher.Filter = "*.bak";
watcher.Filter = "*.tmp";
watcher.Renamed += new RenamedEventHandler(restoredb);
watcher.EnableRaisingEvents = true;
@jaysonrowe
jaysonrowe / TopShelfMain.cs
Created September 20, 2012 01:53
TopShelf Main
public static void Main()
{
HostFactory.Run(x =>
{
x.Service<AutoSQLRestore>(s =>
{
s.ConstructUsing(name => new AutoSQLRestore());
s.WhenStarted(tc => tc.Start());
s.WhenStopped(tc => tc.Stop());
});
@jaysonrowe
jaysonrowe / ASRService.cs
Created September 18, 2012 01:23
ASRService.cs
using System;
using System.Configuration;
using System.IO;
using System.Security.Permissions;
using System.Data;
using System.Text;
using System.Diagnostics;
using System.ComponentModel;
using System.ServiceProcess;
using System.Collections.Generic;
@jaysonrowe
jaysonrowe / restoredb1.cs
Created September 18, 2012 01:22
restore database
res.RelocateFiles.Add(new RelocateFile(mdfname, dbpath + dbname + ".mdf"));
res.RelocateFiles.Add(new RelocateFile(ldfname, dbpath + dbname + "_log" + ".ldf"));
try
{
res.SqlRestore(svr);
}
catch (FailedOperationException fox)
{
str.WriteLine("{0} Exception caught.", fox.Message);