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
| SELECT a, b, c | |
| FROM ( | |
| SELECT *, ROW_NUMBER() OVER (PARTITION BY a ORDER BY b, c) rn | |
| FROM mytable | |
| ) q | |
| WHERE rn = 1 | |
| ORDER BY | |
| a |
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 | |
| //#I "packages/FSharp.Data.2.2.5/lib/net40" | |
| #I "packages/FSharp.Charting.Gtk.0.90.12/lib/net40" | |
| #load "packages/FSharp.Charting.Gtk.0.90.12/FSharp.Charting.Gtk.fsx" | |
| #r "packages/FSharp.Data.2.2.5/lib/net40/FSharp.Data.dll" | |
| open FSharp.Charting | |
| open FSharp.Data |
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 FSharp.Data | |
| type Questions = JsonProvider<"""https://api.stackexchange.com/2.2/questions?site=stackoverflow"""> | |
| let csQuestions = """https://api.stackexchange.com/2.2/questions?site=stackoverflow&tagged=C%23""" | |
| let getResult = | |
| Questions.Load(csQuestions).Items |> Seq.iter (fun x -> Console.WriteLine x.Title) |
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 RProvider.utils | |
| R.install_packages("randomForest") |> ignore | |
| open System | |
| open Deedle | |
| open RDotNet | |
| open RProvider | |
| open RProvider.``base`` | |
| open RProvider.stats | |
| open RProvider.randomForest |
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
| //below line read all lines until eof reach | |
| let lines = Seq.initInfinite (fun _ -> System.Console.In.ReadLine()) |> Seq.takeWhile(fun line -> line <> null) | |
| //below code read all lines and parse as int and print | |
| Seq.initInfinite (fun _ -> System.Console.In.ReadLine()) |> Seq.takeWhile(fun line -> line <> null) |> Seq.map(fun v -> System.Int32.Parse(v)) |> Seq.iter(fun v -> printfn "%i" v) | |
| //iter, iteri, iter2 | |
| let seq1 = [1; 2; 3] | |
| let seq2 = [4; 5; 6] | |
| Seq.iter (fun x -> printfn "Seq.iter: element is %d" x) seq1 |
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
| let rec sum n = if n=0 then 0 else n + sum(n - 1) | |
| sum(10).Dump() //This is for LinqPad |
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
| http://d.stavrovski.net/blog/post/how-to-install-and-setup-oracle-java-jdk-in-centos-6 | |
| # rpm | |
| wget --no-cookies \ | |
| --no-check-certificate \ | |
| --header "Cookie: oraclelicense=accept-securebackup-cookie" \ | |
| "http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.rpm" \ | |
| -O jdk-7-linux-x64.rpm | |
| # ubuntu |
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
| #from tornado.httpclient import HTTPClient | |
| from tornado.httpclient import AsyncHTTPClient | |
| import tornado.ioloop | |
| #client = HTTPClient() | |
| #res = client.fetch("http://www.baidu.com") | |
| #print res.body | |
| def handle_res(res): |
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
| def coroutine(func): | |
| def start(*args, **kwargs): | |
| cr = func(*args, **kwargs) | |
| cr.next() | |
| return cr | |
| return start | |
| @coroutine | |
| def grep(pattern): | |
| print "looking for %s" % pattern |
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
| from lxml import etree | |
| from StringIO import StringIO | |
| s = '''<?xml version="1.0" encoding="UTF-8"?> | |
| <Environment | |
| xmlns="http://schemas.dmtf.org/ovf/environment/1" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xmlns:oe="http://schemas.dmtf.org/ovf/environment/1" | |
| xmlns:ve="http://www.vmware.com/schema/ovfenv" | |
| oe:id="" |