Skip to content

Instantly share code, notes, and snippets.

View mauricio's full-sized avatar

Maurício Linhares mauricio

View GitHub Profile
private Result<T> HandleHttpResult<T> (BasicFuture<Result<T>> future, Action<Result<T>> action, Func<HttpResult> httpResultGenerator)
{
Result<T> result = null;
try {
HttpResult httpResult = httpResultGenerator ();
result = this.parser.ParseResponse<T> ((HttpStatusCode)httpResult.Code, httpResult.ContentType, httpResult.Content, typeof(T));
} catch (WebException e) {
#!/usr/bin/env ruby
=begin
PID="/usr/local/var/mysql/local.pid"
DATA_DIR="/usr/local/var/mysql"
BASE_DIR="/usr/local/Cellar/mysql/5.5.15"
PLUGIN_DIR="/usr/local/Cellar/mysql/5.5.15/lib/plugin"
LOG_ERROR="/usr/local/var/mysql/local.err.log"
trap "echo 'killing MySQL'; kill -SIGQUIT \`cat $PID\`" SIGQUIT SIGTERM
using System;
using System.IO;
using System.Threading;
namespace FileWatcherSample
{
class MainClass
{
public static void Main (string[] args)
{
#! /bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn
@mauricio
mauricio / my.cnf
Created February 10, 2012 15:24
setting mysql to utf8
[client]
port = 3306
socket = mysql
default-character-set=utf8
[mysqld]
port = 3306
socket = mysql
skip-locking
init_connect='SET collation_connection = utf8_general_ci'
@mauricio
mauricio / bad.json
Created February 13, 2012 12:10
json examples
{
"documentId" : "1",
"accountId" : "2"
}
import sbt._
import Keys._
object Build extends sbt.Build {
val unmanagedJars = TaskKey[Keys.Classpath]("unmanaged-jars")
unmanagedJars := {
Configuration.listUnmanaged( file(".").getAbsoluteFile )
}
Unhandled Exception: Microsoft.Http.HttpStageProcessingException: Cannot cast from source type to destination type. ---> System.InvalidCastException: Cannot cast from source type to destination type.
at Microsoft.Http.HttpWebRequestTransportStage+HttpTransportAsyncResult.CreateAndPrepareWebRequest (Microsoft.Http.HttpTransportAsyncResult self) [0x00000] in <filename unknown>:0
at Microsoft.Http.HttpWebRequestTransportStage+HttpTransportAsyncResult..ctor (Boolean preferSync, Microsoft.Http.HttpRequestMessage request, Microsoft.Http.HttpWebRequestTransportSettings settings, System.AsyncCallback callback, System.Object state) [0x00000] in <filename unknown>:0
at Microsoft.Http.HttpWebRequestTransportStage.ProcessRequestAndTryGetResponse (Microsoft.Http.HttpRequestMessage request, Microsoft.Http.HttpResponseMessage& response, System.Object& state) [0x00000] in <filename unknown>:0
at Microsoft.Http.HttpStageProcessingAsyncResult.NextRequest (Microsoft.Http.HttpStageProcessingAsyncResult self) [0x00000]
using System;
class Program {
static void Main ()
{
int p = (int) Environment.OSVersion.Platform;
if ((p == 4) || (p == 6) || (p == 128)) {
Console.WriteLine ("Running on Unix");
} else {
ssh = ssh -l mlinhares
[ui]
username=Mauricio Linhares <[email protected]>
ignore=/Users/mauricio/.hgignore_global
[defaults]
fetch = -v
push = -v