Skip to content

Instantly share code, notes, and snippets.

@leandrosilva
leandrosilva / ParallelSender.cs
Created September 25, 2010 06:21
Just a really dummy sample of parallel C# code (and also using continuations)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace TaskParallelization
{
public class ParallelSender
{
private readonly IList<string> _contents;
@leandrosilva
leandrosilva / README
Created October 23, 2010 20:26
Very simple flush, write, read and remove workflow from C# to Redis
This code use redis-sharp library by Miguel de Icaza.
http://github.com/migueldeicaza/redis-sharp
That's a very simple test of Redis 2.0.1, Mono 2.8 and C# together on Mac OS X Snow Leopard to rock!
@leandrosilva
leandrosilva / README
Created October 24, 2010 01:09
Very simple flush, write, read and remove workflow from F# to Redis
This code use redis-sharp library by Miguel de Icaza.
http://github.com/migueldeicaza/redis-sharp
That's a very simple test of Redis 2.0.1, Mono 2.8 and F# together on Mac OS X Snow Leopard to rock!
See also: http://gist.github.com/642656
@leandrosilva
leandrosilva / async_download.fs
Created October 29, 2010 11:18
Downloads asynchronously some web pages using F# Asynchronously Workflow
#light
(*
Sample code from the article "Asynchronous C# and F# (I.): Simultaneous introduction", avaliable at:
http://tomasp.net/blog/csharp-fsharp-async-intro.aspx
*)
open System
open System.Net
@leandrosilva
leandrosilva / Client.cs
Created October 31, 2010 02:54
Asynchronous Client/Server Socket Example with C# (from MSDN library)
// Asynchronous Client Socket Example
// http://msdn.microsoft.com/en-us/library/bew39x2a.aspx
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.Text;
// State object for receiving data from remote device.
@leandrosilva
leandrosilva / gist:705495
Created November 18, 2010 19:53
BUG // IronRuby + RVM = gem update --system --debug
leandro@codezone ~/.rvm/rubies/ironruby-1.0/bin
$ gem update --system --debug
Updating RubyGems
Updating rubygems-updateERROR: While executing gem ... (ArgumentError)
Invalid path
mscorlib:0:in `GetDirectoryName'
/Users/leandro/.rvm/rubies/ironruby-1.0/bin/../lib/ruby/1.8/fileutils.rb:237:in `fu_mkdir'
/Users/leandro/.rvm/rubies/ironruby-1.0/bin/../lib/ruby/1.8/fileutils.rb:215:in `mkdir_p'
mscorlib:0:in `reverse_each'
mscorlib:0:in `CallSite.Target'
@leandrosilva
leandrosilva / compile.sh
Created November 19, 2010 00:22
A stupid Ruby scripting from a C# program on Mono 2.8
#!/bin/bash
dmcs -r:/opt/ironruby/bin/IronRuby.dll \
-r:/opt/ironruby/bin/IronRuby.Libraries.dll \
-r:/opt/ironruby/bin/Microsoft.Scripting.dll \
-r:/opt/ironruby/bin/Microsoft.Scripting.Core.dll \
program.cs
@leandrosilva
leandrosilva / README
Created November 24, 2010 00:46
Using F# to parse command line options with Mono.Options
Sample code on how to parse command line options with Mono.Options.
Mono.Options can be downloaded and compiled from:
https://github.com/mono/mono/tree/master/mcs/class/Mono.Options/Mono.Options
@leandrosilva
leandrosilva / assembly_metadata.cs
Created November 25, 2010 00:47
Live samples on how to read the metadatas of .NET solutions, projects and assemblies with C#
using System;
using System.Reflection;
using System.Security.Permissions;
[assembly:AssemblyVersionAttribute("1.0.2000.0")]
public class Metadata
{
private int factor;
@leandrosilva
leandrosilva / web2pyrizer
Created December 18, 2010 00:10
web2pyrizer is just a little sugar to develop with web2py
#!/bin/sh
WEB2PY_APPDIR=/opt/web2py/applications
APPNAME=`basename $PWD`
if [ "$1" = "-d" ]; then
echo Deploying $APPNAME application to web2py server at $WEB2PY_APPDIR
ln -s $PWD $WEB2PY_APPDIR/$APPNAME;