Recent Changes - Search:

PmWiki

edit SideBar

Tips

Tips and Tricks


Python

  • Auto-completion and history in python shell:

Create a .pythonrc file containing:

import readline
import rlcompleter
import atexit
import os
readline.parse_and_bind("\C-a: complete")
historyPath = os.path.expanduser("~/.pyhistory")
def save_history(historyPath=historyPath):
import readline
readline.write_history_file(historyPath)
if os.path.exists(historyPath):
readline.read_history_file(historyPath)
atexit.register(save_history)
del os, atexit, readline, rlcompleter, save_history, historyPath

and use the following environment:

export PYTHONSTARTUP=$HOME/.pythonrc

Bash

  • Avoid duplicate history:
export HISTCONTROL=ignoredups
  • Replace in string:
${i/glob_to_replace/replacing_glob}
  • History search:
    • Execute last matching command:
!first_chars_of_command
  • print last matching command:
!first_chars_of_command:p
  • Mount iso file:
mount -o loop -t iso9660 file.iso /media/iso

Others

  • Encoding movie with subtitle:
mencoder -sub subtitle.srt -fontconfig -font Arial -subfont-text-scale 4 -oac mp3lame -lameopts cbr=128 -ovc xvid -xvidencopts bitrate=900 original.avi -o output.avi
  • Calculate cylinder numbers:
CYLINDERS = BYTES / HEADS / SECTOR_BY_TRACKS / SECTOR_SIZE
  • DMenu launching
 ** dmenu_run -i -nf '#888888' -nb '#222222' -sf '#ffffff' -sb '#285577'
Edit - History - Print - Recent Changes - Search
Page last modified on November 28, 2011, at 11:45 AM