Skip to content

Instantly share code, notes, and snippets.

@ChrisMcKee
ChrisMcKee / installHaProxy.sh
Last active August 29, 2015 13:57
Install HA Proxy 1.5 Dev on CentOS ; Source for installs/versions http://haproxy.1wt.eu/download/1.5/src/devel/
#!/bin/bash
### VARIABLES ###
PRE_PACK="openssl-devel pcre-devel make gcc"
VER="1.5-dev22"
# Setup Colours
black='\E[30;40m'
red='\E[31;40m'
@ChrisMcKee
ChrisMcKee / string helper.cs
Created March 3, 2014 22:48
String to Byte Array and Reverse
public static class StringHelper
{
public static byte[] ToByteArray(this string str)
{
byte[] bytes = new byte[str.Length * sizeof(char)];
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
}
public static string GetString(this byte[] bytes)
@ChrisMcKee
ChrisMcKee / vrmdateident.json
Created February 14, 2014 11:13
VRM ident to year and month (data file)
{
"vrmdates": [
{
"y": 1983,
"m": 1,
"ident": "Y"
},
{
"y": 1983,
"m": 8,
@ChrisMcKee
ChrisMcKee / Epoch.cs
Created February 11, 2014 11:34
unix epoch helper
using System;
public static class UnixUtils
{
public static DateTime FromUnixTimeStamp(this Int64 unixTimestamp)
{
return new DateTime(1970, 1, 1).AddMilliseconds(unixTimestamp);
}
public static Int64 ToUnixTimeStamp(this DateTime date)
@ChrisMcKee
ChrisMcKee / nginxinstaller.sh
Last active December 3, 2015 21:55
install nginx from source with spdy and ssl support on CENTOS 6.5
#!/bin/bash
### VARIABLES ###
PRE_PACK="gcc gcc-c++ make pcre-devel zlib-devel unzip wget"
OPT_PACK="openssl-devel"
VER="1.5.12"
PREV_VER="1.5.11"
USER="nginx"
GROUP="nginx"
INSTALL_DIR="/etc/nginx"
@ChrisMcKee
ChrisMcKee / es.sh
Created January 28, 2014 11:48 — forked from nodesocket/es.sh
cd ~
sudo yum -y install java-1.7.0-openjdk
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.1.zip
unzip elasticsearch-0.90.1.zip
rm -rf elasticsearch-0.90.1.zip
mv elasticsearch-0.90.1 elasticsearch
sudo mv elasticsearch /usr/local/share
cd /usr/local/share
using System;
using System.Collections.Specialized;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Moq;
/// <summary>
/// This helper class can be used to set up Moq mocks of MVC3 controllers.
/// Slightly modified from the original version from Scott Hanselman's blog:
@ChrisMcKee
ChrisMcKee / MvcMockHelpers.cs
Created January 20, 2014 10:20
Mvc Mock Helpers (req moq)
public static class MvcMockHelpers
{
public static HttpContextBase FakeHttpContext()
{
var context = new Mock<HttpContextBase>();
var request = new Mock<HttpRequestBase>();
var response = new Mock<HttpResponseBase>();
var session = new Mock<HttpSessionStateBase>();
var server = new Mock<HttpServerUtilityBase>();
@ChrisMcKee
ChrisMcKee / AmazonS3Extensions.cs
Created January 16, 2014 16:43
S3 Client Extensions (IAmazonS3) Adds fluent extensions to check if an object exists, and if an object is the same as one in S3.
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using Amazon;
using Amazon.S3;
using Amazon.S3.Model;
public static class AmazonS3Extensions
@ChrisMcKee
ChrisMcKee / gist:7006083
Created October 16, 2013 11:05
GitFlow quick release cmd. Assuming your using it properly; and presuming you need to make a deployment and don't plan on making 'changes' in the release that have to be merged back. This creates, publishes a release then finishes it,
@echo off
set /p delBuild=Enter the release number (without the v)?
git flow release start v%delBuild% && git flow release publish v%delBuild% && git flow release finish v%delBuild% && git push
git checkout develop
echo "Completed, you're now back on develop"
pause