Skip to content

Instantly share code, notes, and snippets.

View mikeminutillo's full-sized avatar
🏠
Working from home

Mike Minutillo mikeminutillo

🏠
Working from home
View GitHub Profile
@mikeminutillo
mikeminutillo / Architecture Definition
Last active August 29, 2015 14:04
High level DSL for describing architectures according to the model outlined in http://www.codingthearchitecture.com/2014/06/24/software_architecture_as_code.html
internal system techtribes.je
desc techtribes.je is the only way to keep up to date with the IT, tech and digital sector in Jersey and Guernsey, Channel Islands
uses Twitter
Gets profile information and tweets from.
uses Github
Gets information about public code repositories from.
uses Blogs
Gets content using RSS and Atom feeds from.
container Web Application
desc Allows users to view people, tribes, content, events, jobs, etc from the local tech, digital and IT sector.
@mikeminutillo
mikeminutillo / 1.techtribes.context.c4
Created July 18, 2014 17:45
Architecture Definition DSL - Multi-file with components
internal system techtribes.je
desc techtribes.je is the only way to keep up to date with the IT, tech and digital sector in Jersey and Guernsey, Channel Islands
uses Twitter
Gets profile information and tweets from.
uses Github
Gets information about public code repositories from.
uses Blogs
Gets content using RSS and Atom feeds from.
external person Anonymous User
@mikeminutillo
mikeminutillo / ExtractUsernameAndPasswordAsStoredByIE11.cs
Created February 5, 2015 08:19
A LINQPad Script which will retrieve the stored password that IE autocomplete saved against a particular url.
// With massive help from http://securityxploded.com/iepasswordsecrets.php
var urlBytes = System.Text.Encoding.Unicode.GetBytes((url + '\0').ToLower());
byte[] hashBytes;
using(var sha1 = new SHA1Managed())
hashBytes = sha1.ComputeHash(urlBytes);
var checksum = hashBytes.Aggregate((x,y) => (byte)((int)x + (int)y));
var keyBytes = hashBytes.Concat(new[] { checksum }).ToArray();
var regKey = String.Join("", keyBytes.Select(x => x.ToString("X2")));
@mikeminutillo
mikeminutillo / EngineerSamurai
Created December 17, 2010 05:01
Simple Gr1d.org warrior to enter the Arena. The actual actions and strategies are secret sauce :p
public void Tick(IAgentUpdateInfo agentUpdate)
{
if (agentUpdate.Node.OpposingAgents.Any()) FightOrFlight(agentUpdate);
else SeekEnemiesAndBuffUp(agentUpdate);
}
private void FightOrFlight(IAgentInfo agentInfo)
{
if (IsOutnumbered(agentInfo) || IsOutgunned(agentInfo)) Move(agentInfo, FleeStrategy);
else Fight(agentInfo);
}
@mikeminutillo
mikeminutillo / EngineerSamurai.cs
Created December 17, 2010 09:52
The core of my Engineer Samurai. Need to store self as internal state so that I can clean it up a bit
if (EnemiesOf(self).Any())
if (!IsConfident(self) && CanMove(self)) Move(self, Fleeing);
else Fight(EnemiesOf(self));
else if (IsInjured(self)) Heal();
else if (IsBuffed(self) && CanMove(self)) Move(self, Hunting);
else Buff();
using System;
using System.Threading;
namespace MagicUI.Framework
{
public static class Execute
{
[ThreadStatic]
private static bool _isUiThread;
interface IUpdaterUI {
void UpdateStatus(int? progress = null, string message = null);
void SoftwareUpdateComplete();
void DataUpdateComplete();
}
class MyForm : IUpdaterUI {
public void UpdateStatus(int? progress = null, string message = null) {
if(progress.HasValue) SetProgress(progress.Value);
if(message != null) MessageLabel.Do(ctl => ctl.Text = message);
@mikeminutillo
mikeminutillo / Sequencer.cs
Created March 30, 2011 03:27
A reusable component designed to allow only the most recent requests to update the UI
public interface ISequencerToken
{
bool IsCurrent { get; }
}
public class Sequencer
{
private long _currentToken = 0;
private long Bump()
@mikeminutillo
mikeminutillo / Config.cs
Created April 15, 2011 13:40
For AppHarbor use, this will use the config file by default but fall back to the corresponding environment variable if you use the value {ENV}
public interface IConfig
{
string Get(string key);
}
public class Config : IConfig
{
public string Get(string key)
{
var fromConfig = ConfigurationManager.AppSettings[key];
@mikeminutillo
mikeminutillo / gist:949535
Created April 30, 2011 08:41
Quick Tool to update the postName for each entry in my converted BlogML Blogger export file
var inputFile = @"whatever.xml";
var outputFile = @"whatever.updated.xml";
BlogMLBlog blog;
using (var reader = new StreamReader(inputFile))
blog = BlogMLSerializer.Deserialize(reader);
var usedNames = new List<string>();
foreach(var post in blog.Posts.OrderBy(p => p.DateCreated))
{