This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
egrep -io "rt +@\w+" nsports.tsv | perl -pe "s/ +/ /g" | cut -f2 -d\ | sort | uniq -c | sort -rn | head |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void Main(string[] args) | |
{ | |
string line; | |
while ((line = Console.ReadLine()) != null) | |
{ | |
line = line.Trim(); | |
Process(line); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2011 Will Fitzgerald. All rights reserved. | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file. | |
/* | |
Package bitset implements bitsets. | |
It provides methods for making a bitset of an arbitrary | |
upper limit, setting and testing bit locations, and clearing | |
bit locations as well as the entire set. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestIsBad(t *testing.T) { | |
v := MakeBitSet(64) | |
defer recover() | |
v.SetBit(100) | |
t.Fail() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestOutOfBoundsBad(t *testing.T) { | |
v := MakeBitSet(64) | |
defer func() { | |
if r := recover(); r == nil { | |
t.Error("Out of index error within the next set of bits should have caused a panic") | |
} | |
}() | |
v.SetBit(1000) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.IO | |
open System.Net | |
open System.Web | |
// get contents synchronously | |
let http_sync (uri:Uri) = | |
let reader = new StreamReader(WebRequest.Create(uri).GetResponse().GetResponseStream()) | |
reader.ReadToEnd() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
need to change the DTD declarations to point to a local copy of the W3 DTD | |
locally: | |
> ls *.dtd *.ent | |
xhtml1-transitional.dtd xhtml-lat1.ent xhtml-special.ent xhtml-symbol.ent | |
change: | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if INTERACTIVE | |
#r"FSharp.PowerPack.Parallel.Seq.dll" | |
#endif | |
// or add dll to References | |
open Microsoft.FSharp.Collections | |
[1;2;3] |> PSeq.sum;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sort -k2 -rn -t" " | |
# where the text bewteen the "" is Ctrl-V TAB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.IO | |
let readLines (sr:TextReader) = | |
Seq.initInfinite (fun _ -> sr.ReadLine()) | |
|> Seq.takeWhile (fun x -> x <> null) | |
let consoleLines() = | |
readLines Console.In |