Smokes your problems, coughs fresh air.

Category: Technology (Page 35 of 47)

XTerm configuration

I just created a gist for my XTerm configuration (separated from the rest of my X resources). Here’s a snapshot of the current version:

XTerm*background: black
XTerm*Foreground: Grey

XTerm*faceName: Liberation Mono
XTerm*faceSize: 10

XTerm*on2Clicks: regex [^  \n]+

XTerm*bellIsUrgent: true

! Make the terminal 127 by 42 characters in size
XTerm*geometry: 127x44+64+0

! By default, XTerm composes special chars with META. With this setting I can work my readline magic instead.
XTerm*metaSendsEscape: true

! Bracketed paste mode requires the allowWindowOps resource to be true 
XTerm*allowWindowOps: true

XTerm*saveLines: 1000

! Don't jump to the bottom when there's output
XTerm*VT100*scrollTtyOutput: false

XTerm*VT100.Translations: #override \
    ShiftInsert: insert-selection(CLIPBOARD) \n\
    Insert: insert-selection(PRIMARY) \n\
    Shift: insert-selection(CLIPBOARD) \n\
    ShiftUp: scroll-back(1) \n\
    ShiftDown: scroll-forw(1)


! vim: set syntax=xdefaults expandtab tabstop=4 shiftwidth=4:

Old Window Maker screenshot from April 2004

While cleaning up old images, I came across a screenshot of an old Window Maker configuration that I ran in 2004. It looks a bit different from my current configuration, but not that different, which just goes to say how little Window Maker has changed in the last five years. The main difference I see in terms of Window Maker capabilities is that Window Maker now has font anti-aliasing support.

I notice that I was actually using VIM’s folding support at the time. Also, it’s funny to see that I was in the middle of the development of a (now stale, even more badly written) fork of phpBB.

Window Maker Workspace (2004)

Window Maker Workspace (2004)

Modern self-hosted, open-source web statistics software

I’ve been using Google Analytics for most of my websites for quite some time. Philosophically, I’d prefer a self-hosted solution though. In the past I’ve used Webalizer and I still use awstats for my ad-hoc, static website, but these programs are a bit primitive and limited compared to Analytics.

Of the newer programs that I’ve been looking into Piwik looks the most promising to me, but there’s also Obsessive Website Statistics which looks pretty reasonable. W3Perl looks pretty, but seems rather spartan.

An example of Piwik in action

An example of Piwik in action

One of the things that has made me a bit shy of Google Analytics is its reliance on JavaScript, a dependence that means that I can’t gather statistics about robots or other user agents lacking JavaScript support. On the other hand, this method lets you gather much more data for the clients that do support JavaScript. Piwik depends on JavaScript in the same way as Google Analytics does. This can be seen as either an advantage or a disadvantage depending on your view on this issue.

I’d have to install Piwik to determine my view…

Permissions on a samba share

When you mount a samba share without unix extensions enabled, you can set a GID, UID and permissions (on the client machine, at mount time) so you can adjust it to let non-root users use it.

Mounting FAT works this way as well. But there is a big difference. Where new files on a FAT file system are created according to the permissions you set at mount-time, new files on a SAMBA share have their permissions determined by the umask. However, when you unmount and remount the share, the permissions are changed to what they were set to at mount time.

This is very annoying behavior, because when you have files that belong to root:smbusers and you copy a file, it still belongs to root:smbusers, but when your umask is 0022, it will no longer be group writable and it has become a read only file.

I think this is a bug in the SMBFS/CIFS file system driver.

Samba rounds filesizes off to whole MB’s

I noticed when I did ‘du -hs’ on a sambamount, I got a disk usage that was unrealistically high. I did some research, and it appears that Samba rounds off file sizes to whole MB units, to optimize for windows clients:

And btw, why is samba rounding the minimum size up to 1MB ?

An optimisation for Windows clients. If we do this they allocate actually run faster against a Samba server (based on tests done by a NAS vendor).

Bash quoting

I’m always confused by bash’s quoting. I hope to put all my quote wisdom in this post and invoke other’s quote wisdom in the comments. I’ll give some examples of what I mean.

Let’s say you have a file with a space: “bla bla.txt”. If I were to ls that file, I would do:

ls 'bla bla.txt'

This works. However, when I want to do this from a variable (in a script) and do:

command="ls 'bla bla.txt'"
$command

The result is:

ls: cannot access 'bla: No such file or directory
ls: cannot access bla.txt': No such file or directory

You can solve this by using eval:

command="ls 'bla bla.txt'"
eval $command

This gives:

bla bla.txt

Some time ago, I suggested this as answer on somebodies question at userfriendly, to which somebody else said that using eval actually makes things worse:

That’s actually worse. . . as the quoting gets re-parsed (remember, ‘eval’ means “take arguments as shell input”), which means that single quotes in the name break it, horribly, and names with spaces get even _worse_.

Another example: let’s say you have two files:

-rw-r----- 1 halfgaar halfgaar 0 2009-10-18 16:51 bla's bla"s.txt
-rw-r----- 1 halfgaar halfgaar 0 2009-10-18 16:52 normal.txt

I’m gonna run this command on it: find . -mindepth 1 -exec ls ‘{}’ \;. When executed without eval, it says this:

find: missing argument to `-exec' 

With eval, it says:

./normal.txt
./bla's bla"s.txt

Eval seems to be what I need, so what is wrong with using it? Also, shouldn’t that double quote be a problem? If someone can give a situation where that poses problems, I’m all ears.

VIM insert mode shortcuts

A few months back, I stumbled upon a blog post with some interesting VIM shortcuts for within insert mode.

  • Ctrl+t and Ctrl-d adjust the current line indent one level to the right and left, respectively.
  • Ctrl+w deletes the last word. I already use this one a lot because it’s the same as in Readline’s Emacs mode (which I prefer over its vi mode).
  • Ctrl+u deleted all the way to the first non-whitespace character.

But the best stuff was in the comments:

  • Ctrl+o enters normal mode for just one command and then returns to insert mode. I find myself very often going to normal mode ‘temporarily’. This should make these occasions pass quicker.
  • Ctrl+y repeats the character at this position from the line above in this line. Ctrl+e does the same for the line below.
  • Ctrl+x Ctrl+l can be used to copy a whole line, allowing you to cycle through the lines with Ctrl+P and Ctrl+N.
« Older posts Newer posts »

© 2024 BigSmoke

Theme by Anders NorenUp ↑