Skip to content

Instantly share code, notes, and snippets.

Robert Pickering robertpi

Block or report user

Report or block robertpi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View tweet.fs
// ported from the C#:
open System
open System.Net
open System.Text
let postTweet username password tweet =
let user = Convert.ToBase64String(Encoding.UTF8.GetBytes(username + ":" + password))
// determine what we want to upload as a status
let bytes = Encoding.ASCII.GetBytes("status=" + tweet)
View findusedfiles.fs
open System.IO
open System.Xml
let initDir = @"C:\Users\Workspace\Storm.Xsor-SDP-clean"
let fileSet =
Directory.GetFiles(initDir, "*.*", SearchOption.AllDirectories)
|> Seq.filter (fun path -> not (path.EndsWith(".csproj") || path.EndsWith(".sln") || path.Contains(".svn") ))
|> (fun path -> path.Replace(initDir, ""))
|> Set.ofSeq
View findduptreeconflict.fs
// scrip for finding problem "svn: Attempt to add tree conflict that already exists"
open System.IO
let logLines =
File.ReadAllLines @"C:\USERS\Visual Studio 2008\Projects\FindDup\FindDup\svnlog.txt"
|> Seq.filter (fun x -> x.StartsWith("Tree conflict:"))
|> Seq.groupBy (fun x -> x)
|> (fun (key, vals) -> key, Seq.length vals)
|> Seq.filter (fun (_, count) -> count > 1)
View logprimatives.fsx
module LP
open System
open System.IO
open System.Text.RegularExpressions
/// Opens the given file and returns a sequence of it's lines. This sequence is lazy, as lines are consumed they
/// will be read from the disk. This is useful for large files as it provides a convient way to read them without
/// pulling them all into memory
let readAllLinesLazy file =
seq { use textReader = new StreamReader(File.Open(file, FileMode.Open, FileAccess.Read))
View printlargefiles.fs
open System.IO
open System.Collections.Generic
let rec getSize =
let memorize = new Dictionary<string, int64>()
fun dir ->
if memorize.ContainsKey(dir) then
let size =
View hellnonoo.cs
string myPhrase = "Hell is round the corner where I shelter";
myPhrase = string.Replace(myPhrase, "Hell", "Hevean");
View helloo.cs
string myPhrase = "Hell is round the corner where I shelter";
myPhrase = myPhrase.Replace("Hell", "Hevean");
View AMethod.cs
class A {
static void AMethod(MyBase myBase) {
View encapright
class A {
private List<string> myList = new List<string>();
private List<string> GetCurrentItems(){
return new List<string>(myList);
You can’t perform that action at this time.