This command will start a simple SMTP server listening on port 1025 of localhost. This server simply prints to standard output all email headers and the email body.
You can use a site like http://www.jsonlint.com/ or use the command line to validate your long and complex json data. This is part of the simplejson package for python http://undefined.org/python/#simplejson.
Wrong json expression example:
echo '{ 1.2:3.4}' | python -m simplejson.tool
Expecting property name: line 1 column 2 (char 2)
Show Sample Output
Validates and pretty-prints the content fetched from the URL. Show Sample Output
I use this command to start a local Python document server over HTTP port 8888.
Convert JSON to YAML. Note that you'll need to have PyYaml installed.
usage: :[rang]ret[!][tabstop value] python is indent sensitive, after command :set list you may see your codes are mixed with tab and space ret can help you to convert space to tab or tab to space
An alternative to: python -m SimpleHTTPServer for Arch Linux source: http://archlinux.me/dusty/2010/01/15/simplehttpserver-in-python-3/ Show Sample Output
A common programming question for interviewers to ask potential job candidates is to code "FizzBuzz". That is, if a number is divisible by 3, then it should display "Fizz". If a number is divisible by 5, it should display "Buzz". If it is divisible by both, then it should display "FizzBuzz". Otherwise, display the current number between 1 and 100. Show Sample Output
Converts YAML file to JSON. Note that you'll need to install PyYAML. Also some YAML data types (like dates) are not supported by JSON).
Replace 'csv_file.csv' with your filename.
You have to do that before :
cd ~/.mozilla/firefox/<YOUR PROFILE>
Require bash. If you use something else, you may use
echo <CODE> | python
Forked from ArkSeth python script.
This works on all versions of python 2.X. Tested on Linux and bundled python versions on Mac OSX and Solaris / UNIX Note: Serves globally on port 8000. Ctrl+c to stop. Don't start the server and leave it on a internet connected machine. :) Show Sample Output
Raise your hand if you haven't used this at least once to share a directory quickly
on multihomed hosts, connected to several networks, could be usefull to know the source address (local ip address) used to reach the target host, this command does not require root priviledges. The command use a TCP socket, if there is any error the command return an empty string, elsewhere return a valid ip address. Show Sample Output
You can install filterous with
sudo apt-get install libxslt1-dev; sudo easy_install -U filterous
Show Sample Output
You can use "decode()" in a similar manner:
python -c 'print "68656c6c6f".decode("hex")'
Show Sample Output
(1) required: python-googl ( install by: pip install python-googl ) (2) get from google API console https://code.google.com/apis/console/ Show Sample Output
Uses pygmentize and python to create indented and colorized JSON output Show Sample Output
This utilizes the Requests and BeautifulSoup libraries in Python to retrieve a user page on commandlinefu, parse it (error-tolerant) and extract all the lines of the following format: gzip * To print them, a list comprehension is used to iterate over the values, and join() is called on a newline character. Show Sample Output
* Output is jq compatible * Output is single lines - unix compatible * Multiple files supported
Given a requirements.txt file with unpinned package names, output the packages pinned to the latest version. Handy to copy/paste back into your requirements.txt when you start a new project. Note that this will download packages but not install them. Show Sample Output
This will save and execute your python script every time your press the F5 function key. It can also be added to your .vimrc: autocmd BufRead *.py nmap :w^M:!python % NOTE: the ^M is not just caret-M, it can be created by type: ctrl-v ctrl-m Show Sample Output
This function defines a command line calculator that handles everything pythons math module can handle, e.g. trigonometric functions, sqrt, log, erf, ... (see http://docs.python.org/library/math.html). It even knows about the constants pi and e. Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: