Archive

Posts Tagged ‘firefox’

visit freenode IRC channels in your browser

December 23, 2014 Leave a comment
Categories: Uncategorized Tags: , ,

open links in okular with Firefox

July 10, 2014 Leave a comment

Problem
You have a PDF that contains links. You click on a link but it opens in a strange browser (Konqueror?). How to open links with Firefox?

Solution

  1. Run the command “kcmshell4 filetypes“. File Associations – KDE Control Module will open.
  2. Search for html and select the file type text/html.
  3. Move the application name you want to be a default for html in the “Application Preference Order” to the top.

I copied this solution from here. Credits go to djhurio.

Categories: ubuntu Tags: , , ,

How to speed up Firefox

September 5, 2011 1 comment

Problem

I’ve had some problems recently with Firefox 6: sometimes it freezes for a few seconds, the CPU usage jumps up to 100%, then everything goes back to normal. It gets annoying when it happens in every 10 minutes…

Solution

I looked after the problem and found some tips.

Delete cache

The cache can grow quite big, so delete it:

https://support.mozilla.com/en-US/kb/How%20to%20clear%20the%20cache

Vacuum SQLite

Firefox stores your browsing data and some other stuff in SQLite databases. These database files must be maintained sometimes to wipe old junks out of them. Go to ~/.mozilla/firefox/XXXXXXXX.default where you will find the .sqlite files (places.sqlite, etc.). Execute the following command:

$ for i in *.sqlite; do echo "VACUUM;" | sqlite3 $i ; done

This operation compacted my places.sqlite from 10.2 MB to 1.8 MB!

This tip is from here.

Update (20110924)

To tell the truth, the methods above didn’t solve the blocking problem on my laptop. So I moved on to Firefox 7 with an empty ~/.mozilla folder. I think something got messed up in my mozilla home folder and the blocking problem was due to that. After all, I’ve been using that folder for years… Sometimes it’s a good idea to start with a tabula rasa.

README.markdown on GitHub

May 5, 2011 12 comments

For a quick and painless solution check out the last update at the end of the post.

When you create a project on GitHub, it is highly encouraged to add a README file too. Thus, when someone visits your project’s page, they will see the content of your README file automatically (example).

If you want, you can use the markdown syntax in your README files. In this case don’t forget to rename the file to README.markdown. It has the advantage that the output is much nicer while the source remains readable in a normal text editor too (example).

Update: You can also name the file as README.md. In the future I’ll use the .md extension, it’s shorter and simpler.

To learn more about the markdown syntax, refer to these links:

Problem

When I write a README.markdown file, I’d like to visualize it before uploading to GitHub. If there is a problem, I don’t want to commit this file several times. I’d like to refine it on my local machine and when it’s good, I want to upload it once.

Solution

I came up with the following Python script to visualize marked up files:

import os
import sys

MARKDOWN = 'markdown'
UPSKIRT = 'upskirt'

PROGRAM = MARKDOWN
VERBOSE = True

def main():
    update = False

    if len(sys.argv) < 2:
        print "Usage: {0} <file.markdown> [-u]".format(sys.argv[0])
        sys.exit(1)
    # else
    if '-u' in sys.argv:
        update = True
        sys.argv.remove('-u')
    input_file = sys.argv[1]
    os.system("{program} {input} > /tmp/markdown.html".format(program=PROGRAM, input=input_file))
    if not update:
        os.system("chromium-browser /tmp/markdown.html &")
    if VERBOSE:
        print >>sys.stderr, "# renderer: {0}".format(PROGRAM)

#############################################################################

if __name__ == "__main__":
    main()

The up-to-date version of the script is available in this GitHub repository.

Usage: put it in your ~/bin directory (make sure ~/bin is in your PATH), make it executable (chmod u+x ~/bin/markdown.py), and call it as “markdown.py README.markdown“. It will open the HTML output in a new tab. Adding the “-u” switch (update), the HTML is not opened in the browser.

Typical usage: call it first as “markdown.py README.markdown“, then add the “-u” switch and refresh the output in the browser.

Ref.: I saw this idea here but I couldn’t make it work with Ruby. I added the “-u” switch to make it easier to use.

Update (20110507)

First, I managed to install redcarpet. It was not easy… I wrote a post about it.

Second, if you want to use the GitHub flavored markdown, you don’t need to install redcarpet. I figured out later that redcarpet is just a Ruby wrapper for upskirt. So you can use upskirt directly. It’s written in C, just compile it and use the executable binary “upskirt“. This is integrated in the new version of the script (available here).

Update (20120212)
The “upskirt” project is gone from Github. It is replaced by sundown. Sundown is a fork of upskirt and this is the version used by Github too.

Update (20120219)
As it was pointed out by Teodor in a comment, the easiest way is to use the text editor ReText. It has a live preview function (Ctrl+Shift+E), thus editing Markdown or reStructuredTexts is made trivial. ReText is written in Python by the way.

Update (20141203)
I found an even nicer editor for markdown files: Remarkable. I write about it here.

Update (20150820)
Here is the ultimate solution :) Use the Atom editor with the markdown-preview package. Open a rendered version of the Markdown in the current editor with “Ctrl-Shift-M”.

Ubuntu 11.04 Natty Narwhal

April 29, 2011 5 comments

Yesterday I installed the newest Ubuntu on my machines. The upgrade went smoothly, there were no problems. I collect here my notes about this new release.

If you want to upgrade several machines, read this post. With this “trick” you can reuse the downloaded packages on other machines too.

Unity redefines F10. As I use Midnight Commander a lot, it’s quite annoying as F10 means “quit” in MC. A workaround is to use ESC + 0 in MC, but that’s a PITA. Also, I assigned something to F10 in vim… Here is how to disable F10 in Unity: (1) install compizconfig-settings-manager and start it, (2) filter “unity” and start the Ubuntu Unity Plugin, (3) edit “Key to open the first panel menu” and disable it. Now everything is back to normal.

With CTRL + ALT + T you can start a new instance of your default terminal emulator. I use terminator, so here is how to make it the default: click on the power button in the top right corner and choose “System Settings”. On the left side at the bottom you will see “Set Preferred Applications”. Start it, and under the System tab specify your favorite terminal emulator.

Want to monitor the RAM / CPU usage? Execute the following commands:

sudo add-apt-repository ppa:alexeftimie/ppa
sudo apt-get update
sudo apt-get install indicator-sysmonitor
indicator-sysmonitor &

I use this customized output: “| CPU: {cpu} | RAM: {mem} |”. To edit it, right click on the applet and choose Preferences.

Is the Dropbox indicator applet gone? Here you will find a fix.

Missing the weather indicator? Execute “sudo apt-get install indicator-weather“. (via webupd8)

Unity wallpapers with shortcuts: here.

After playing one day with Unity, I found one thing very frustrating: there is no bottom panel for the applications, so I never know what programs are running. I noticed that I was pressing ALT + TAB a lot… I was already thinking of switching back to Ubuntu Classic when I could figure out how to get the bottom panel back. You just need to launch “gnome-panel” and customize the new panel. Add it to your startup applications, this way it will be launched each time you log in. It also added a top panel that I removed (right click, delete). Customization: right click and add “Window List” and “Workspace Switcher”. Since this is a classic panel, you can add all those applets that are missing in Unity, for instance the “System Monitor”.

If you find the global menu (File, Edit, etc. are on the top panel like in MacOS) annoying, here is how to get rid of it (via webupd8):

sudo apt-get remove appmenu-gtk indicator-applet-appmenu indicator-appmenu

Log out and log back in to take it into account. (edit: same thing in 11.10)

Under Eclipse I had a strange problem. Sometimes it crashed with the error message “The program ‘Eclipse’ received an X Window System error.” I found the solution here. In short, I had two xulrunner instances on my system, versions 1.9.1 and 1.9.2. Fire up Synaptic and remove 1.9.1.

With Firefox, I also had some strange problems. I couldn’t drag and drop an URL from the location bar to the Bookmarks. Or, sometimes the popup menu activated with the right mouse button disappeared when I moved the mouse pointer above it. The following command solved these problems:

sudo apt-get remove firefox-globalmenu

If you don’t like the new overlay scrollbars, here is how to get rid of them:

sudo apt-get remove overlay-scrollbar liboverlay-scrollbar-0.1-0

This tip is from here.

Categories: ubuntu Tags: , , , , ,