05/02/2015 par Mario Loriedo & Vincent Demeester
C'est une intro, prochaine session dans 1 mois
- outil pour partager env de dev et env de prod (sysadmin) #devops: "build, ship and run" via conteneurs => + rapide, automatisation
| ### BRANCHES | |
| git checkout -b <branch name> # Create a branch | |
| git branch -r # List remote branches | |
| git checkout <branch name> # Switch to branch (deprecated) | |
| git switch <branch name> # Switch to branch | |
| git checkout <commit ID> # Locally retrieve an old revision | |
| git fetch # retrieve remote changes (commits) without changing local repo ; can be used to fix sync issue | |
| git branch -D branchName # delete local branch | |
| git branch -m <newname> # rename current local branch | |
| git push origin --delete <branchName> # delete remote branch |
| -- http://learnyouahaskell.com | |
| -- Starting out | |
| ----------------------------------------------------------------------------------- | |
| -- baby's first functions http://learnyouahaskell.com/starting-out#babys-first-functions | |
| doubleMe x = x + x | |
| doubleUs x y = doubleMe x + doubleMe y | |
| doubleSmallNumber x = if x > 100 | |
| then x |
| Programming languages | |
| (* Emacs tips : | |
| open file: ctr-c ctr-f | |
| copy: M-w, paste: ctr+y | |
| save file: ctr+x ctr+s, | |
| next/previous buffer: ctr+x left/right: | |
| start REPL: ctr+c ctr+s sml, stop REPL: ctr+c ctr+d | |
| stop command interpreter: ctr-g | |
| split window vertically: C-x 2 |
| ( Introduction to Racket: | |
| Racket: | |
| - functional focus | |
| - with imperative features | |
| - dynamically-types | |
| - minimalist syntax | |
| - advanced features: modules, macros, etc... | |
| (note: we will not use pattern matching, but it exists) |
| Part 3 | |
| Introduction to Ruby { | |
| Our focus { | |
| Pure Object-Oriented | |
| no primitives (even numbers) | |
| Class-based | |
| Every object has a class that determines behavior (like Java) |
| // array | |
| var myArray = [1, 2, 3]; | |
| // set | |
| var mySet = { "foo": true, "bar": true, "baz": true }; | |
| set.foo // true | |
| set.notExists // false | |
| var object = { id: 126878, name: "ZALTRAP 25 mg/ml sol diluer p perf", sid: "vidal://product/126878", title: "ZALTRAP 25 mg/ml sol diluer p perf" }; |
| # CPU & mem usage per process (sampling) | |
| top # list processes | |
| top -h # list threads | |
| top -c # show full command line | |
| htop | |
| # CPU usage per CPU: | |
| mpstat -P ALL 1 | |
| # Processes (uptime, hierarchy, CPU usage, etc...): |
| import System.CPUTime | |
| fibo :: Int -> Int | |
| fibo n | |
| | n <= 1 = n | |
| | otherwise = fibo(n - 1) + fibo(n - 2) | |
| getCPUTimeDouble :: IO Double | |
| getCPUTimeDouble = do t <- System.CPUTime.getCPUTime; return ((fromInteger t) * 1e-12) |