Posts filed under logs | Page 5 of 8

modeline needs to be set for it to work

Note that in order for vim modelines to work, you must have the ‘modeline’ option set, i.e. :set modeline. Do a :help modeline for more info.

Fixing a corrupted sudoers file

If you accidentally corrupt your /etc/sudoers file (usually by reading it without sudo, incorrectly interpreting that it is empty, and then writing into it w...

Using apt-get behind a proxy

Often what happens is that the proxy settings that are set via the command line are not reflected when executing sudo apt-get update/upgrade. The reason this...

Temporarily redifining macros with gcc

You can save and restore macros by using #pragma push_macro("<macro_name>") and #pragma pop_macro("<macro_name>") respectively! This means that y...

Stage only part of a file in git

In order to add only some lines of a file for committing, use git add -p <filename>. If the file is new, use git add -N <filename>. Look up this ...

xsessionrc and xmodmap

In order to have your xmodmap commands take effect, put them in .xsessionrc, NOT .xinitrc. Take a look at this. Also, man xmodmap for a few examples of remap...

Using ASCII codes in vim

To insert characters with a certain ascii code in vim, use <C-v><code>. For example, <C-v>178 will print the squared symbol. I think only t...

Open binary files in vim

To open binary files in a readable format, use vim -b. A more complex tool is xxd. Look at this link or man xxd for more info.

Vim search register

You can substitute the last search pattern in vim either by omitting the search pattern in the :%s command, or by inserting the contents of the search regist...

np.astype

To convert data types in numpy or scipy use np.astype.

Adobe reader messes up bash completion

Adobe reader messes up bash completion. Delete /etc/bash_completion.d/acroread.sh in order to solve the issue. Why does acroread of all things even need bash...

Changing user and group IDs in Linux

Changing a user id will only change ownership of files that are in that user’s home directory. Look at this SO question. Also, you might have to change the g...

Linux useradd and adduser

For a first-level reference on how to use these commands, look at this link. After that, man adduser. It is nicer than useradd.