Giter VIP home page Giter VIP logo

clf's Introduction

clf - Command line tool to search snippets on Commandlinefu.com

image

Commandlinefu.com is the place to record awesome command-line snippets. This tool allows you to search and view the results into your terminal.

Example 1

$ clf python server

  # python smtp server
  python -m smtpd -n -c DebuggingServer localhost:1025

  # Python version 3: Serve current directory tree at http://$HOSTNAME:8000/
  python -m http.server

  # Start a HTTP server which serves Python docs
  pydoc -p 8888 & gnome-open http://localhost:8888

  # put current directory in LAN quickly
  python -m SimpleHTTPServer

  # An alternative to: python -m SimpleHTTPServer for Arch Linux
  python3 -m http.server

Example 2

$ clf recursive line count

  # Recursive Line Count
  find ./ -not -type d | xargs wc -l | cut -c 1-8 | awk '{total += $1} END {print total}'

  # Recursive Line Count
  find * -type f -not -name ".*" | xargs wc -l

  # Get Total Line Count Of All Files In Subdirectory (Recursive)
  find . -type f -name "*.*" -exec cat {} > totalLines 2> /dev/null \; && wc -l totalLines && rm totalLines

  # Recursive Line Count
  wc -l `find . -name *.php`

Installation

The tool works with Python 2 and Python 3. It can be installed with Pip :

pip install clf

Usage

Command line tool to search snippets on Commandlinefu.com

Usage:
  clf --browse [options]
  clf <command> [options]
  clf <keyword> <keyword>... [options]

Options:
  -h, --help     Show this help.
  -v, --version  Show version.
  -c, --color    Enable colorized output.
  -b, --browse   Browse the Commandlinefu.com archive.
  --order=ORDER  The order output (votes|date) [default: votes].
  --proxy=PROXY  The proxy used to perform requests.

Examples:
  clf tar
  clf python server
  clf tar --proxy=http://127.0.0.1:8080
  clf --browse --order=date

Notes

  • You can set the CLF_COLOR environment variable to enable the colorized output by default.
  • You can import the clf module and use it in your own scripts :
>>> from clf import Clf
>>> c = Clf()
>>> for cmd in c.browse():
>>>     print(cmd.summary)
>>>     print(cmd.command)

clf's People

Contributors

ncrocfer avatar

Watchers

Imo Alexander 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.