Skip to content

Instantly share code, notes, and snippets.

@jstedfast
jstedfast / ArcValidationTests.cs
Created May 31, 2019 15:31
MimeKit ARC validation unit tests
//
// ArcValidationTests.cs
//
// Author: Jeffrey Stedfast <jestedfa@microsoft.com>
//
// Copyright (c) 2013-2019 Xamarin Inc. (www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@jstedfast
jstedfast / uninstall-xamarin.sh
Last active October 3, 2019 17:20
uninstall-xamarin.sh
#!/bin/bash
echo "Uninstalling the Xamarin Installer..."
rm -rf ~/Library/Caches/XamarinInstaller/
rm -rf ~/Library/Caches/VisualStudioInstaller/
rm -rf ~/Library/Logs/XamarinInstaller/
rm -rf ~/Library/Logs/VisualStudioInstaller/
rm -rf ~/Library/Preferences/Xamarin/
echo "Uninstalling Xamarin.Android..."
// first we need to base64 decode the content of the existing pkcs7-mime part
var content = new MemoryStream ();
pkcs7.Content.DecodeTo (content);
content.Position = 0;
// now we create a new pkcs7-mime part with the proper smime-type parameter
pkcs7 = new ApplicationPkcs7Mime (SecureMimeType.EnvelopedData, content);
// now decrypt it:
var decrypted = pkcs7.Decrypt (ctx);
@jstedfast
jstedfast / dkim-pubkey.cs
Created June 3, 2016 18:47
How to load a DKIM public key from a string
using System;
using System.IO;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.OpenSsl;
namespace DkimKeyLocatorExample
{
public class Program
{
@jstedfast
jstedfast / reply.cs
Last active February 26, 2016 18:19
A sample program illustrating how to generate a reply to a message
//
// ReplyVisitor.cs
//
// Author: Jeffrey Stedfast <jeff@xamarin.com>
//
// Copyright (c) 2016 Xamarin Inc. (www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@jstedfast
jstedfast / HtmlToText.cs
Created January 25, 2016 21:25
HTML to plain text converter
//
// HtmlToText.cs
//
// Author: Jeffrey Stedfast <jeff@xamarin.com>
//
// Copyright (c) 2016 Xamarin Inc. (www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
class CustomOrdinalIgnoreCaseComparer : IEqualityComparer<string>
{
static int ToLower (int c)
{
if (c >= 0x41 && c <= 0x5A)
return c + 0x20;
return c;
}
using System;
using System.Text;
namespace Blah {
public class Program
{
public static void Main (string[] args)
{
const string base36 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
ulong value = ulong.MaxValue;
// WARNING
//
// This file has been generated automatically by Xamarin Studio from the outlets and
// actions declared in your storyboard file.
// Manual changes to this file will not be maintained.
//
using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4510" systemVersion="13B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MessageListTableViewCell">
<connections>
<outlet property="FromLabel" destination="7" id="name-outlet-7"/>
<outlet property="SubjectLabel" destination="4" id="name-outlet-4"/>