Skip to content

Instantly share code, notes, and snippets.

@jlyonsmith
jlyonsmith / ImageTools.cs
Created August 17, 2012 17:16
Function to rotate an image using Cairo in C#/Mono.
public enum ImageRotation
{
None,
Left,
Right,
UpsideDown
}
public class ImageTools
{
@jlyonsmith
jlyonsmith / mkbundle2.sh
Created January 14, 2014 20:09
This is a shell script for running Mono's mkbundle on OSX Mountain Lion and above.
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/pkgconfig:/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig
#
# See http://stackoverflow.com/questions/13979044/mkbundle-on-mac-with-mono-mono-metadata-mono-config-h-file-not-found?rq=1
#
export AS="as -arch i386"
export CC="clang -arch i386 -mmacosx-version-min=10.6"
mkbundle --deps $*
# http://www.mono-project.com/Compiling_Mono_on_OSX
require 'formula'
class Mono < Formula
url 'http://download.mono-project.com/sources/mono/mono-3.2.3.tar.bz2'
homepage 'http://www.mono-project.com/'
sha1 'e356280ae45beaac6476824d551b094cd12e03b9'
def install
@jlyonsmith
jlyonsmith / csharptools.rb
Last active January 3, 2016 17:19
Homebrew Formula for installing CSharpTools
require 'formula'
class Csharptools < Formula
homepage "http://jlyonsmith.github.io/CSharpTools/"
url "https://s3-us-west-2.amazonaws.com/jlyonsmith/CSharpTools-3.0.10427.tar.gz"
sha1 "ec1e27fa9196479afa7e2f5d9ecd2970fec03d79"
def install
mono_path = `/usr/bin/which mono`.strip
if mono_path.size == 0 || `#{mono_path} --version`.index(/3\./) == nil
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Post Ex-Dividend Profit on Single Share" />
<script type="text/javascript" src="//www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>
<meta charset=utf-8 />
<title>JS Bin</title>
@jlyonsmith
jlyonsmith / ExpandoObjectHelper.cs
Last active August 29, 2015 13:56
ExpandoObjectHelper
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Xml.Linq;
namespace ToolBelt.Dynamic
{
//
// This class came from http://www.codeproject.com/Articles/461677/Creating-a-dynamic-object-from-XML-using-ExpandoOb
@jlyonsmith
jlyonsmith / S3Helper.cs
Created February 11, 2014 04:33
S3Helper
using System;
using System.Net;
using System.Net.Http;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using ToolBelt;
using System.IO;
@jlyonsmith
jlyonsmith / IAM_Backup_User_Policy.json
Last active September 24, 2016 22:43
Script and support files for backing up Redmine database to AWS S3 bucket. Replace 'xxx' with correct values.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::xxx-redmine-backups"
@jlyonsmith
jlyonsmith / toaster.rb
Created April 8, 2014 06:41
Homebrew formula for Toaster unit test tools
require 'formula'
class Csharptools < Formula
homepage "http://jlyonsmith.github.io/Toaster/"
url "https://s3-us-west-2.amazonaws.com/jlyonsmith/Toaster-2.0.20407.tar.gz"
sha1 "aeadb20cf4cfbf9886a2d60c30c4b883fcd5196a"
def install
mono_path = `/usr/bin/which mono`.strip
if mono_path.size == 0 || `#{mono_path} --version`.index(/3\./) == nil
@jlyonsmith
jlyonsmith / RedisCacheClient.cs
Created August 19, 2014 09:59
ICacheClient for ServiceStack using StackExchange.Redis
using System;
using System.Collections.Generic;
using ServiceStack.Caching;
using StackExchange.Redis;
using ServiceStack.Text;
using System.Linq;
namespace Shared.ServiceInterface
{
public class RedisCacheClient : ICacheClient, IRemoveByPattern