Posterous theme by Cory Watilo

Filed under: cool

Awesome

Tassilo Horn: A quick pop-up shell for emacs

Some file managers provide a shortcut to quickly embed some terminal that’s initialized with the current directory as cwd. Wouldn’t that be cool to have in emacs?

For example, you edit some file, and then you want to quickly commit it. Using the code below, you can do that like this:

  • Edit the file and save: C-x C-s
  • Popup a shell: F12
  • Check changes and commit (using svn):
    $ svn diff | colordiff
    $ svn ci -m "some changes" RET
  • Close the popup shell again: F12
  • Here’s the code:

    (defvar th-shell-popup-buffer nil)
    
    (defun th-shell-popup ()
      "Toggle a shell popup buffer with the current file's directory as cwd."
      (interactive)
      (unless (buffer-live-p th-shell-popup-buffer)
        (save-window-excursion (shell "*Popup Shell*"))
        (setq th-shell-popup-buffer (get-buffer "*Popup Shell*")))
      (let ((win (get-buffer-window th-shell-popup-buffer))
            (dir (file-name-directory (or (buffer-file-name)
                                          ;; dired
                                          dired-directory
                                          ;; use HOME
                                          "~/"))))
        (if win
            (delete-window win)
          (pop-to-buffer th-shell-popup-buffer nil t)
          (comint-send-string nil (concat "cd " dir "\n")))))
    
    (global-set-key (kbd "<f12>") 'th-shell-popup)

    Using that, hitting F12 will popup a *Popup Shell* buffer, initialized in the directory containing the file your are currently editing. If the current buffer is not associated with a file, then the shell’s cwd is your HOME directory.

    Hitting F12 while the popup shell buffer is visible will hide it again. So you can use it as a simple toggle.

    The code ensures that the same shell buffer is reused over and over again (unless you kill it), so that you don’t end up with hundredth of them.

    And here’s a screenshot:

    UPDATES:

    Nyilván (NYILVÁN) megtérek most már, de azért szeretnék ilyent Vim-ben is. Most.

    Hogy néha egy (nagyon) jó hírt is

    Magyarra fordítják az internetes iskolát

    Szedlák Ádám|2011. 09. 12., 10:47|Utolsó módosítás: 2011. 09. 12., 11:16|

    eszközök:

    Önkéntesek fordítják le a Khan Academy internetes oktatóoldal előadásait. A csapat még épp csak elkezdte a munkát, ám a szorzótáblát vagy a helyiértékeket már meg lehet tanulni az oldalról.

    Az internet egyik legnagyobb oktatóanyagokat tartalmazó portálja egyszerű családi korrepetálásként kezdte. A kis Nadiát az unokabátyja, a pénzügyi elemzőként dolgozó Salman Khan kezdte matematikára tanítani a Yahoo Doodle internetes jegyzetfüzetének segítségével. A leckékről videókat is készített, amelyeket a YouTube-on osztott meg. A videók óriási népszerűségre tettek szert, az állását a tanításért feladó Khan pedig hamarosan a Colbert Report tévéshow-ban és az NPR amerikai közszolgálati rádióban mesélt az addigra Khan Academy névre keresztelt projektjéről. Eddigre az oldalon már nem csak matematika-, hanem fizika-, biológia- és történelemleckék is voltak.

    A Khan Academy még 2009-ben megkapta oktatási kategóriában a Microsoft Tech Awardot, Bill Gates pedig a 2010-es Aspen Ideas fesztiválon bevallotta, hogy maga is használja gyermekeivel az oldalt. A Khan Academy működéséhez szükséges tőkét magánszemélyek adományaiból és a Google kétmillió dolláros támogatásából teremtették elő.

    Kell

    Kiwix: An Offline Reader for Wikipedia!

    Wikipedia is an excellent resource, and, let’s be honest, it can be quite fun to get lost in it for hours at a time. However, to read Wikipedia, you need to be connected to the Internet, and not everyone has access to the World Wide Web 24 hours a day. Have you ever been stuck away from home and desperately needed to look something up, only to see no available wireless networks on your netbook, tablet, or laptop? It’s a problem that has frustrated many since the birth of Wikipedia, and finally, an offline reader for Wikipedia has become available.

    Kiwix is a neat little program that allows users to read content from Wikipedia offline. Using ZIM files, Kiwix displays articles exactly as they would appear on Wikipedia (pictures and all!), and also provides some functions that are used in web browsers (such as the ability to use tabs and bookmarks). Combine this with links to other articles, options, like selecting a random article to view, and it’s easy to forget that this is only an offline version of Wikipedia!