Giter Site home page Giter Site logo

python's Introduction

nextbus.py

Purpose

A program which will tell you how long it is until the next bus on "BUS ROUTE" leaving from "BUS STOP NAME" going "DIRECTION" using the api defined at http://svc.metrotransit.org/.

"BUS ROUTE" will be a substring of the bus route name which is only in one bus route, "BUS STOP NAME" will be a substring of the bus stop name which is only in one bus stop on that route, and "DIRECTION" will be "north", "east", "west", or "south"

The program won’t return anything if the last bus for the day has already left. The bus route, stop and direction are all case insensitive. If using partial names for routes and stops the first occurrence returned will be used.

Example

$ nextbus.py "metro blue line" "target field station platform 1" "south"

8 Minutes

Requirements

Requires at least Python 2.6 because of requests library (https://github.com/kennethreitz/requests). Request library can be installed via pip (pip install requests). Support for Python 3.x is unknown.

Tests

$ nextbus.py "foobar" "target field station platform 1" "south"

Usage: nextbus.py route stop direction

$ nextbus.py "foobar" "target field station platform 1" "south"

Route foobar doesn't exist!

$ nextbus.py "metro blue line" "target field station platform 1" "foobar"

Direction foobar doesn't exist for route metro blue line!

$ nextbus.py "metro blue line" "foobar" "south"

Stop foobar doesn't exist for route metro blue line and direction south!

getdiskusage.py

Purpose

Prints a list of all files in a directory and their total size in bytes in a JSON format.

Example

$ getdiskusage.py /tmp

{ "files": { "/tmp/foo": 1000, "/tmp/bar": 1000000, "/tmp/buzzz": 42 } }

Requirements

Requires at least Python 2.6 because of json library. Support for Python 3.x is unknown.

Tests

$ getdiskusage.py foobar

foobar is not a directory!

$ getdiskusage.py /root

Cannot access /root directory!

$ getdiskusage.py /foobar

Directory /foobar doesn't exist!

python's People

Contributors

jschingen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.