commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
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:
To print them, a list comprehension is used to iterate over the values, and join() is called on a newline character.
If you tried the other Python version of Convert JSON to YAML and you end up with lines that has "!!python/unicode", this version of the command is for you.
for i rang(10) = length of the password
random.choice("abcdefghijklmnopqrstuvwxyz...") = char allowed into the password
Thanks Python/Django FAQ's.
I tried a few curses based mp3 players for playing back choir practice songs for my wife.
Unfortunately none of the ones I tried were capable of scrubbing a track.
Firefox saves the day.
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.
They are using json now
Good because it doesn't use Sed.
For situations where you keep JSON in a VCS and you want your diffs to be sane, such as within a Chef configuration repo.
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 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.
you need ruby gems and localtunnel, further instruction on their website
for ubuntu precise, just intall ...
sudo apt-get install ruby ruby1.8-dev rubygems1.8 libopenssl-ruby
sudo gem install localtunnel
ssh-keygen -t rsa
python -m SimpleHTTPServer 8000
sudo localtunnel -k ~/.ssh/id_rsa.pub 8000
(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 :)
useful if you are using lots of data URI's in your css files
Very useful for test a script. After launch this command, you only have to press ENTER for launch your script again. I work with screen and tape ENTER instead of '!!'+ENTER
If you break your script with CTRL-C, it will wait for press ENTER and will re-launch
You can write like it : while read -p "Press ENTER" ; do python ; done
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.
Remove dashes, also validates if it's a valid UUID (in contrast to simple string-replacement)