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
| #lang racket | |
| (define-syntax-rule (foo form ...) | |
| ((lambda (bar) form ...) "ARG")) | |
| (foo "Hello") ; => returns "Hello" | |
| (foo bar) ; => expand: unbound identifier in module in: bar |
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
| # I want to run bartask only if a line output from footask starts with a period. | |
| # I'm not sure what is valid to use for "???" below. | |
| # Things that don't work are: is, =, ==, equals, sameas, find. | |
| - name: footask | |
| command: ... | |
| register: manifest | |
| - name: bartask | |
| debug: msg="bartask ran" |
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
| $ ansible-playbook playbook.yml | |
| PLAY [playbook] ************************************************************* | |
| GATHERING FACTS *************************************************************** | |
| ok: [hosts] | |
| TASK: [register a var] ******************************************************** | |
| skipping: [hosts] | |
| TASK: [print a var] *********************************************************** |
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
| --- | |
| - hosts: localhost | |
| vars: | |
| - foo: | |
| a: 1 | |
| b: 2 | |
| c: 3 | |
| tasks: | |
| - debug: msg="{{ item }} is {{ foo[item] }}" | |
| with_items: foo|list |
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
| 127.0.0.1 localhost |
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
| fn main() { | |
| println!("{:?}", format!("{}", 1).as_bytes()); | |
| } | |
| /* | |
| main.rs:2:22: 2:39 error: borrowed value does not live long enough | |
| main.rs:2 println!("{:?}", format!("{}", 1).as_bytes()); | |
| ^~~~~~~~~~~~~~~~~ | |
| main.rs:2:14: 2:20 note: reference must be valid for the block at 2:13... | |
| main.rs:2 println!("{:?}", format!("{}", 1).as_bytes()); |
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
| use std::hashmap::HashMap; | |
| fn main() { | |
| let v = [("a", 1), ("b", 2), ("c", 3)]; | |
| let m: HashMap<~str, int> = v.iter().map(|&(s, n)| (s.to_owned(), n)).collect(); | |
| let keys = [~"a", ~"b", ~"c"]; | |
| for k in keys.iter() { | |
| println!("{:?}: {:?}", k, m.get(k)); | |
| } | |
| } |
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
| - name: test playbook | |
| hosts: localhost | |
| tasks: | |
| - name: test lineinfile | |
| local_action: lineinfile dest="{{ playbook_dir }}"/test.txt state=present line=foo create=yes | |
| # failed: [127.0.0.1 -> 127.0.0.1] => {"failed": true} | |
| # msg: missing required arguments: regexp |
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
| [group1] | |
| localhost | |
| [group1:vars] | |
| n = 1 | |
| [group2] | |
| localhost | |
| [group2:vars] |
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
| int main(void) { | |
| int x = 1; | |
| x = x + 0.1; | |
| } |
OlderNewer