commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
You need to apt-get install python-sqlparse. This command simply formats a sql query and prints it out. It is very useful when you want to move a sql query from commandline to a shell script. Everything is done locally, so you don't need to worry about copying sql query to external websites.
Install twistd first with
sudo apt-get install python-twistd-web
Good because it doesn't use Sed.
Convert JSON to YAML.
Note that you'll need to have PyYaml installed.
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).
Generate a Netscape cookies file to use with Python's mechanize.
Generate a 18 character password from character set a-zA-Z0-9 from /dev/urandom, pipe the output to Python which prints the password on standard out and in crypt sha512 form.
Terminal Color tester using python, works with py2 and 3
Pre-packaged python script that comes with Debian/Ubuntu.
Uses pygmentize and python to create indented and colorized JSON output
Sample USAGE: f = open(os.path.join(__location__, 'bundled-resource.jpg'));
vs. map(unicodedata.name, u'\u2022')
(1) required: python-googl ( install by: pip install python-googl )
(2) get from google API console https://code.google.com/apis/console/
Realtime lines per second in a log file using python ... identical to perl version, except python is much better :)
You can use "decode()" in a similar manner:
python -c 'print "68656c6c6f".decode("hex")'
Python is always such much more readable than most shell scripting.
An alternative to: python -m SimpleHTTPServer for Arch Linux