Skip to content

Instantly share code, notes, and snippets.

@caspian311
caspian311 / FilterOrderTests.cs
Created February 9, 2012 16:01
nice little unit tests for ensuring the authorization filters and order of those filters in your .NET MVC web app
using System;
using System.Linq;
using System.Reflection;
using System.Web.Mvc;
using NUnit.Framework;
using WebApplication.Filters;
namespace WebApplicationTests.Filters
{
[TestFixture]
@caspian311
caspian311 / pom.xml
Created July 15, 2011 15:17
Axis2 service with a Maven build
<!--
<project-directory>
- src
-main
- axis2
<all-wsdl-and-xsd-files>
- java
<all-src-code>
- resources
- META-INF
@caspian311
caspian311 / gitk-font-size-fix.txt
Created July 11, 2011 19:20
ubuntu gitk font size fix
$ gitk
see that the font size sucks
$ sudo apt-get install -y tk8.5
$ sudo update-alternatives --config wish
select the 8.5 version (usually option 3)
@caspian311
caspian311 / non-rails-cucumber-howto.txt
Created July 11, 2011 16:48
How to setup cucumber for non-rails web apps
-------------------------------------------------------------------------------
RVM Install
-------------------------------------------------------------------------------
$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
$ source .bash_profile
@caspian311
caspian311 / gist:996044
Created May 27, 2011 20:01
getting android source to work in eclipse
in browser, go to: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=snapshot;h=android-sdk-<android-os-version>;sf=tgz
expand into <android-sdk-directory>/platforms/sources/android-<android-api-level>/sources
for <android-sdk-directory>:
installation directory for the android SDK
for <android-api-level>:
eclair = 7
froyo = 8
@caspian311
caspian311 / WhatAlgAmIUsingDuringHTTPS
Created April 6, 2011 15:27
print out what encryption algorithm you're using in a HTTPS connection
import java.net.URL;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
@caspian311
caspian311 / grab-cert
Created March 11, 2011 22:23
Grab the public certificate from a remote https server to be installed into your ~/.pki/nssdb database for use by Google Chrome and whoever else looks there for certs.
#!/bin/bash
read -p "host (example: www.google.com): " HOSTNAME
read -p "port[443]: " PORT
if [ -n $PORT ]; then
PORT=443
fi
echo 'Q' | openssl s_client -connect $HOSTNAME:$PORT -showcerts 2>&1 | sed -n '/BEGIN CERTIFICATE/,/END CERTIFICATE/p' > /tmp/server.cert.file.pem
@caspian311
caspian311 / android activity navigation
Created December 15, 2010 12:52
found that the lifecycle of an activity was annoying so i use this to navigate between the different pages/activities of my android app
import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
import android.app.Activity;
import android.content.Intent;
public class PageNavigator {
private final IntentFactory intentFactory;
private final Activity homeActivity;