Thursday, 18 September 2014

Emacs evil mode

I decided to have a look at Emacs evil mode (the Vi mode for Emacs). Vim is not really suitable as an IDE. It's an editor and anything else tends to be a bit of a hack. Debugger is one such issue, it's not very convenient to use gdb inside Vim. As an added bonus I can use Lisp instead of Vimscript to write scripts.

But I like Vim's editing better than Emacs's endless control-meta-this-and-that approach. It's faster and more convenient. I might try Emacs without Evil mode at some point, I'm a pragmatist after all but at least this way I don't have to learn the entire Emacs editing thingy just to get started. I'm familiar with M-x, C-x C-f, C-x C-f and the like which should suffice for now.

Installing was almost like a breeze. Had I figured out Ubuntu 12.04 uses emacs23 instead of emacs24 which all the help I can google points to I would have had an easier time. But here's how I got started:

sudo add-apt-repository ppa:cassou/emacssudo apt-get updatesudo apt-get install emacs24git clone ~/.emacs.d/undo-treegit clone git:// ~/.emacs.d/evil

Then I added the following to .emacs:
(add-to-list 'load-path "~/.emacs.d/evil")  (require 'evil)  (evil-mode 1)
(load-theme 'wombat)

Last line loads the wombat colour scheme. I use wombat256 in Vim.

Now I just need to figure out how to get the same functionality as my favourite Vim plugins have. For instance, CtrlP. Someone suggested ido mode, but I can't seem to get it to do recursive search. In CtrlP you don't have to know where a file is to find it.

Thursday, 3 July 2014

Headphones in Ubuntu

I bought a set of Beyerdynamic DT660's (got them cheap) to use at work. But when I plugged them into the work machine (runs Ubuntu 12.02) sound quality was horrible. Bass was non-existent ans high frequencies intolerable. In other words it was impossible to listen to music. I first tried an equalizer (qpaq) and while it did improve the sound a bit it was still not good enough.

I just got a Behringer U-Control UCA202 USB-DAC with headphone amp and boy is this a big improvment! At 29€ a no-brainer. Installation was also totally painless. This would suggest the issue is with the Intel HDA driver. So if you hate the sound that you get from analog output from your Linux box, get one of these (or any other USB-DAC with headphone amp). You won't regret it.

Monday, 9 June 2014

Unsupported AMD hardware watermark in Ubuntu

Got this when I installed binary drivers in my new work computer. Then I upgraded packages and it reappeared. The way to fix this is to give the command:
sudo apt-get install fglrx-updates
After this the issue should be sorted.

Tuesday, 13 May 2014

Ubuntu: setting up a new box

I need to swap my work computer and being a lazyass programmer I decided to check out how to do this with as little hassle as possible. Here's what I came up with. This assumes basic Ubuntu installation is done on the new comp (and commands are run as sudo).
1. Get installed packages from both computers:
dpkg --get-selections > /safe/location/installed-old
dpkg --get-selection > /safe/location/installed-new
2. Save metadata from old computer:
apt-mark showauto > /safe/location/pkgs_auto.lst
apt-mark showmanual > /safe/location/pkgs_manual.lst
3. Get list of packages to install:
grep -vFf installed-new installed-old > missing 
You can go through that list manually to remove any that you don't want installed anymore.

4.  On the new box, install packages:
cat missing | cut -f 1 | tr '\n' ' ' | sudo xargs apt-get -y --force-yes install
5. Restore metadata: 
sudo apt-mark auto $(cat /safe/location/pkgs_auto.lst) 
sudo apt-mark manual $(cat /safe/location/pkgs_manual.lst)
This way system can still keep track of which packages were manually and which were automatically installed. This means that system can automatically remove packages no longer needed.

You have to add the missing apt repositories before step 4.

Monday, 28 October 2013

Snippets moved

I completed my transfer of snippets from Smipple to GitHub, so now they are available again. I guess I need to fix the embedded code in my old posts as well at some point.

But no sooner had I thought Mygists would fix the problem of finding the Gists than it's down. Hopefully not for long. The good thing is that Mygists is open-source and in any case has a usable API so I can always set up my own service if needed.

Now I wonder if I should move my small projects from there? A gist can include more than one file so at least a couple of those projects would work well.

Friday, 25 October 2013

D'oh, or theme continued.

I had completely forgotten that GitHub supports this as well. They just call these snippets Gists. I think this pretty much is a no-brainer now. GitHub versions the files , allows branching and I can even download all Gists on a go, although it requires a bit of scripting (hey ho). The only thing I miss right now are tags.

And the same code as an embedded Github Gist looks like:

We have a winner!

EDIT: I just found out MyGists. It supports tagging the gists with hashtags, so now the last big problem is solved - how to find the script I want after I have a large number of them.

Snippets, continued

I tried the snippet databases mentioned in my last post. I dropped DZone quickly without even trying it because it just looks ugly. SourcePod was interesting, but not really a database as there is no login. You can only find your old scripts from the same machine you submitted them.

That leaves Snipt and Snipplr. Here's what the embedded code looks like for Snipt:

And the same code for Snipplr:

I was eventually more drawn toward Snipplr but I'm starting to lean toward Snipplr for two reasons: first it looks like not much is happening at Snipplr any more. Last blog post was two years ago. API documentation is in one initial blog post years back. Snipt on the other hand seems to still be under active development. And Snipt is open source! Snipplr is still being used but it's still a bit disconcerning.

There are things in Snipplr I wish Snipt had. The embedded output for one, line numbers are nice. It also supports versions for each snippet.

Neither supports direct Git support. It would be nice to be able to pull your scripts occasionally so that if the service stops working I still have them readily available.