Skip to content

Instantly share code, notes, and snippets.

$ cat /etc/redhat-release
CentOS release 5.9 (Final)
$ arch
i686
$ cd /usr/local/src
$ sudo wget http://redis.googlecode.com/files/redis-2.6.11.tar.gz
$ sudo tar xzvf redis-2.6.11.tar.gz
$ cd redis-2.6.11
$ sudo make
zmalloc.o: In function `zmalloc_used_memory`:
@ChrisMcKee
ChrisMcKee / AsyncHelper.cs
Last active December 6, 2023 11:37
AsyncHelpers to simplify calling of Async/Task methods from synchronous context. (use https://github.com/aspnet/AspNetIdentity/blob/master/src/Microsoft.AspNet.Identity.Core/AsyncHelper.cs this is ancient code)
namespace My.Common
{
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
public static class AsyncHelpers
{
/// <summary>
using ServiceStack.WebHost.Endpoints;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security;
using ServiceStack.Common.Web;
using ServiceStack.Logging;
using ServiceStack.ServiceHost;
using ServiceStack.ServiceInterface;
@ChrisMcKee
ChrisMcKee / Backup and Archive.bat
Created August 8, 2013 09:29
Archive SQL backups in CMD / DOS
@echo off
set SAVESTAMP=%DATE:/=-%@%TIME::=-%
@echo on
7z a -t7z %SAVESTAMP%.7z *.sql
forfiles /P "X:\DROPBOX\Dropbox\MySqlBackups" /S /M *.sql /D "-1" /C "cmd /c del @PATH"
@ChrisMcKee
ChrisMcKee / pointless_1321343.cs
Last active November 11, 2019 00:15
Pointless string replace benchmark. Just for fun (D commented out because, urgh)
namespace ConsoleApplication1
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
public class Program
{
@ChrisMcKee
ChrisMcKee / Checkbox Extension.cs
Created April 8, 2013 07:56
Checkbox Extension
namespace UI.Helpers
{
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using System.Web.Routing;
@ChrisMcKee
ChrisMcKee / BoxedAuthenticationModule.cs
Created March 20, 2013 23:45
module to cleanse a user of temporary authentication by boxing them within a controller. Theres more elegant ways of handling this such as creating custom user
namespace xxx.Web.Auth
{
using System;
using System.Web;
using xxx.Domain.Entities;
static class ContextExtension
{
public static bool IsValidForInterrogation(this HttpContext context)
{
@ChrisMcKee
ChrisMcKee / AuthCookie.cs
Created March 20, 2013 20:55
FormsAuthentication class + AuthCookie
namespace xxx.Web.Auth
{
using System;
using System.Globalization;
using System.Web;
using System.Web.Security;
using Domain.Entities;
public class AuthCookie
{
@ChrisMcKee
ChrisMcKee / Readme _ Using Umbraco Content Service outside of Umbraco context.md
Last active January 12, 2017 13:41
Get Email Template By Template Name from Umbraco via /Base and content service Setting content service so that its available within the application from ANYWHERE that can access the application. Simple Example (So you'd need to clean your own shit up in the Rest Controller) The URL would be http://www.xxxx.local.dev/base/EmailTemplateHelpers/Get…

Using Umbraco Content Service outside of Umbraco context/control

Or Getting content from umbraco using the Umbraco Content Service

We could call it a guide to why Umbraco dont understand the term Gateway... but that would be harsh.

Get Email Template By Template Name from Umbraco via /Base and content service Setting content service so that its available within the application from ANYWHERE that can access the application.

Simple Example (So you'd need to clean your own shit up in the Rest Controller)

@ChrisMcKee
ChrisMcKee / LinqExtensions.cs
Created January 4, 2013 14:02
SortBy (Enumerable / Linq)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
public static class LinqExtensions
{
public static IEnumerable<T> SortBy<T>(this IEnumerable<T> list, string sortExpression)
{
sortExpression += string.Empty;