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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """ | |
| HTTP server that provides a web interface to run "tail" on a file, | |
| like the Unix command. | |
| This is a standalone script. No external dependencies required. | |
| How to invoke: |
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 pyparsing import * | |
| # By default, PyParsing treats \n as whitespace and ignores it | |
| # In our grammer, \n is significant, so tell PyParsing not to ignore it | |
| ParserElement.setDefaultWhitespaceChars(" \t") | |
| def parse(input_string): | |
| def convert_prop_to_dict(tokens): | |
| """Convert a list of field property tokens to a dict""" | |
| prop_dict = {} |
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
| #Snippet for getting the default gateway on Linux | |
| #No dependencies beyond Python stdlib | |
| import socket, struct | |
| def get_default_gateway_linux(): | |
| """Read the default gateway directly from /proc.""" | |
| with open("/proc/net/route") as fh: | |
| for line in fh: | |
| fields = line.strip().split() |
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
| object scala { | |
| val version = "SCALA_VERSION$" | |
| } | |
| val xml = <dependencies> | |
| <dependency> | |
| <groupId>org.scalanlp</groupId> | |
| <artifactId>scalala_${scala.version}</artifactId> | |
| <version>0.3.1</version> | |
| </dependency> |
NewerOlder