Monday, November 30, 2015

Slow Alt-Tab behaviour in Linux Mint

I personally do my best to avoid using the mouse. Thus, I use keyboard a lot, in particular I do 'Alt+Tab' to switch between applications (This doesn't work in Gnome3 and likes due to window grouping by default which is something totally ridiculous by the way). In new Linux Mint, Alt+Tab behaviour is noticeably slow (or sticky if you will). This can be overcome by turning off 'Preferences->Desktop Settings->Window-s -> Performance -> Use compositing"

Saturday, June 1, 2013

Bash to Python migration cheat sheet

Explanation Bash Python
change directory cd os.chdir(“/some/path/”)
print working directory pwd os.getdir()
print 4th line sed -n “4p” somefile linecache.getline(‘somefile’, 4)
list files ls subprocess.call(“ls”, shell=True)
remove/delete a file rm somefile subprocess.call(“rm somefile”, shell=True)
print 3rd column in a line echo ‘this is a line’ | awk ‘{ print $3 }’ “this is a line”.split()[3]
print 3rd column in a file awk ‘{ print $3 }’ somefile
for line in somefile
    line.split()[2]    

Monday, January 21, 2013

gitit as personal wiki

These days I am playing around with gitit  to see if it can make a good personal wiki. In fact, I am also curious how a personal wiki will improve my life.  In order to turn gitit to a personal wiki I did the followings.
  • standard installation from ubuntu repository with apt-get 
  • modify config file for minor things like if login required or session expiry time. In order to print a default config file see gitit man page or help file.
  • one needs a folder under which config file will be put along with the whole wiki. So I created a folder under home: ~/personal_wiki
  •  the main thing which makes gitit a personal wiki is restricting it's access to the local host. So created the following command alias:  alias pwiki='cd ~/personal-wiki/ ; gitit -f gitit.conf -l 127.0.0.1 -p 12000 & cd -' 
  • I don't like using mouse; so I edit wiki page files (*.page) under ~/personal-wiki/wikidata/ with a simple text editor, then I commit it using another comman alias I created: alias commit='cd ~/personal-wiki/wikidata/ ; git commit -am "committed from command line"; cd -'
  • Finally, I preview the wiki withing a web browser by typing http://127.0.0.1:12000/ in adresbarr which is nothing but locahost ip and port number assigned to gitit.

Tuesday, April 3, 2012

set vlc as default media application in Ubuntu, Fedora (and probably other Linux distros) from command line

Given that Totem is the default media player in Ubuntu, one can set VLC as default media player by replacing every instance of "totem.desktop" in the file /usr/share/applications/defaults.list by "vlc.desktop" as follows.
1. sudo cp /usr/share/applications/defaults.list /usr/share/applications/defaults.list.backup
2. sed 's/totem.desktop/vlc.desktop/g' /usr/share/applications/defaults.list > tempfile
3. sudo mv tempfile /usr/share/applications/defaults.list 


References: VLC wiki page

Sunday, November 27, 2011

efficient/productive computer user, keyboard shortcuts, tip #7

for any program where editing involved, one can copy, paste, cut, save with Ctrl+S, Ctrl+V, Ctrl+X, and Ctrl+S respectively. Also Ctrl+O should bring open-file menu which is useful to know.

efficient/productive computer user, keyboard shortcuts, tip #6

bring power menu to restart, suspend, hibernate, or power off your computer. Simply do Alt+Ctrl+Delete. Note that one can of course do this from a terminal as well.

efficient/productive computer user, keyboard shortcuts, tip #5

Focus to or unfocus to desktop with OS-key+D or Alt+Ctrl+D