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 ast import ( | |
| NodeTransformer, | |
| arguments, | |
| arg, | |
| Lambda, | |
| parse, | |
| In, | |
| Call, | |
| Expression, | |
| fix_missing_locations, |
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 sys | |
| from sly import Lexer, Parser # type: ignore | |
| from collections.abc import Iterable | |
| # lamb -> LAMB ID DOT term | |
| # lamb -> appl | |
| # appl -> appl term | |
| # appl -> term | |
| # term -> LPAR lamb RPAR | |
| # term -> ID |
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 sys | |
| from sly import Lexer, Parser | |
| from collections.abc import Iterable | |
| # lamb -> LAMB ID DOT term | |
| # lamb -> appl | |
| # appl -> appl term | |
| # appl -> term | |
| # term -> LPAR lamb RPAR | |
| # term -> ID |
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
| eval((λx.x) 1) | |
| eval((λx.x)) | |
| eval(1) | |
| appl((λx.1), 1) => 1 | |
| eval((λx.(λy.x)) 1 2) | |
| eval((λx.(λy.x)) 1) | |
| eval((λx.(λy.x))) | |
| eval(1) | |
| appl((λx.(λy.1)), 1) => (λy.1) |
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
| #!/Users/gecko/code/deployment/minsible | |
| - debug: |
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
| #!/bin/sh | |
| # | |
| # Wrapper over ansible include tasks to make simple executable playbooks | |
| # example https://gist.github.com/e39284344e3fd29b3202571678b6a343 | |
| task="${PWD}/$1" | |
| ansible localhost -m include_tasks -a file=$task -c local -i /dev/null |
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
| using System; | |
| namespace hello | |
| { | |
| // A typed primitive it narrows the type of primitive | |
| class TypedPrim<T> | |
| { | |
| public T Value { get; set; } | |
| public static implicit operator T(TypedPrim<T> v) => v.Value; | |
| public static explicit operator TypedPrim<T>(T v) => new TypedPrim<T>() { Value = v }; |
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 typing import * | |
| import re | |
| Result = Tuple[str, Any] | |
| Parser = Callable[[str], Result] | |
| class ParseError(Exception): | |
| pass |
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 get(obj, attr, default=None): | |
| """ | |
| Fetch an attribute deeply nested on an object or dict, return `default` if not found | |
| >>> class Foo: pass | |
| >>> f = Foo() | |
| >>> f.a = Foo() | |
| >>> f.a.b = Foo() | |
| >>> f.a.b.c = 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
| # test with `nc -kl 3000` | |
| # write to nc terminal to send data | |
| import socket | |
| import sys | |
| try: | |
| s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| print("Socket successfully created") | |
| except socket.error as err: | |
| print("socket creation failed with error %s" %(err)) |