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
| import xml.etree.ElementTree as ET | |
| @shared_task | |
| def test_et(): | |
| print('test_et') | |
| fpath = '<xml-file>' | |
| t = ET.parse(fpath) | |
| print('--- t', t) |
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
| -- Exercise 1 | |
| invalidInt :: MaybeInt -> Bool | |
| invalidInt (ValidInt _) = False | |
| invalidInt InvalidInt = True | |
| maybeIntValue :: MaybeInt -> Int | |
| maybeIntValue (ValidInt val) = val | |
| maybeIntValue InvalidInt = 0 |
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
| -- Exercise 1 | |
| formableBy :: String -> Hand -> Bool | |
| formableBy [] _ = True | |
| formableBy [letter] hand = letter `elem` hand | |
| formableBy (letter:letters) hand | |
| | letter `elem` hand = formableBy letters (delete letter hand) | |
| | otherwise = False | |
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
| -- Exercise 1 | |
| lastDigit :: Integer -> Integer | |
| lastDigit x = mod x 10 | |
| dropLastDigit :: Integer -> Integer | |
| dropLastDigit x = div x 10 | |
| -- Exercise 2 |
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
| ➜ data git:(master) ✗ cat b12.dat | java vehicle | java -jar ../target/satellite.jar | |
| 3 12122.917273542467 2.60523431377833E7 2986153.9652811266 4264669.833341302 | |
| 4 12122.918115953327 -1.7183556330883846E7 -1.8640834276143264E7 7941901.319790134 | |
| 8 12122.915172212155 1.849827925650694E7 -1.417239006512881E7 -1.2758766854626015E7 | |
| 11 12122.929474066532 -2903225.428341161 -1.966135853793516E7 1.7630410370027628E7 | |
| 14 12122.930816872351 1477645.0131373822 -1.521487230845357E7 2.1729089560153764E7 | |
| 15 12122.915592052117 2.652632365288924E7 847508.5773716164 -1210367.6854701233 | |
| 17 12122.932126745905 4939777.113827618 -1.7965663283148237E7 1.8938390959181942E7 | |
| 20 12122.930290188273 1.7903461115956523E7 -1.680512822045815E7 1.0143118496003771E7 | |
| 3 12123.917274955005 2.6051583575288303E7 2988333.2598301014 4267782.188507524 |
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://en.wikipedia.org/wiki/Decision_tables | |
| ;; http://rosettacode.org/wiki/Decision_tables | |
| ;; this example is ported from the pico lisp example | |
| (defn yes? [condition] | |
| (print (str (first condition) "? ")) | |
| (flush) | |
| (loop [reply (read-line)] | |
| (cond | |
| (contains? #{"T" "Y" "YES" "Yes" "y" "yes" "true" "1"} reply) true |
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
| # A quick introduction to python for math students (Paul English <paul@onfrst.com>) | |
| ################################################################################ | |
| # Python Setup | |
| ################################################################################ | |
| # 1. Install python 2.7 (or 3.0, both should work well) | |
| # 2. Install pip | |
| # 3. Install numpy using the command line tool pip | |
| # pip intall numpy |
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
| (defn argmax [f coll] (reduce (fn [a b] (if (> (f a) (f b)) a b)) coll)) | |
| (defn fools-constant [C N] | |
| (let [n (argmax #(mod % 1) | |
| (for [n (range 1 N)] (* C n)))] | |
| [n (/ n C)])) | |
| (fools-constant Math/PI 100) | |
| (fools-constant Math/E 100) |
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
| api = $resource('http://127.0.0.1/api/v1/:type/:id', | |
| { | |
| type: '@type' | |
| id: '@id' | |
| }, | |
| { | |
| get: {method: 'GET'} | |
| post: {method: 'POST', headers: {'Content-Type': 'application/json'}} | |
| del: {method: 'DELETE', headers: {'Content-Type': 'application/json'}} | |
| create: {method: 'POST', headers: {'Content-Type': 'application/json'}} |
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
| > summary(factor.train) | |
| ACTION RESOURCE MGR_ID ROLE_ROLLUP_1 ROLE_ROLLUP_2 | |
| 0: 1897 4675 : 839 770 : 152 117961 :21407 118300 : 4424 | |
| 1:30872 79092 : 484 2270 : 99 117902 : 742 118343 : 3945 | |
| 25993 : 409 2594 : 82 91261 : 721 118327 : 2641 | |
| 75078 : 409 1350 : 71 118315 : 498 118225 : 2547 | |
| 3853 : 404 2014 : 67 118212 : 400 118386 : 1796 | |
| 6977 : 299 16850 : 66 118290 : 398 118052 : 1665 | |
| (Other):29925 (Other):32232 (Other): 8603 (Other):15751 | |
| ROLE_DEPTNAME ROLE_TITLE ROLE_FAMILY_DESC ROLE_FAMILY |