Allow user to execute command as another user without password (linux)

For security reasons you usually want to allow a user to execute only specific command as another user without using any password. This can be done using sudo command.

Lets have an example, where user1 need to execute /path/to/your/command.sh as user2.

Sudo command will look like this:
sudo -u user2 /path/to/your/command.sh

We need to configure /etc/sudoers file:
1. Allow user1 to sudo as user2 without password only when /path/to/your/command.sh is executed.
2. (optional) Allow to execute sudo by user1 without any tty/shell (e.g. from webserver page).

Defaults:user1 !requiretty
user1 ALL=(user2) NOPASSWD: /path/to/your/command.sh

That’s all you need for such a task!

Misha Mansoor string gauges

Misha of Periphery mentioned strings he currently use on his facebook page (as of 27 Sep 2013):

So I have been getting a lot of questions about the strings and gauges I use. To clear it up: I use D’addario strings, because they are the brightest (and manage to stay bright even when I am sweating all over them on the road). On my 6 stringers I use the EXL 117 11-56 Set (perfect tension for Drop C!):

Set text selection color for Spark TextInput using css

When you’ll try to set text selection for s|TextInput using css, it makes no effect.
If you dig a bit, you’ll see that RichEditableText is used in default TextInput skin.

So setting selection color for RichEditableText will do the trick:

s|RichEditableText {
	focusedTextSelectionColor: #aaaaff;
	unfocusedTextSelectionColor: #aaaaff;
	inactiveTextSelectionColor: #aaaaff;
}

Another possibility is to set custom skin for TextInput and define focusedTextSelectionColor for RichEditableText in mxml.

WordPress “SEO Facebook comments” duplicated comments

I’ve been using “SEO Facebook comments” WordPress plugin for a while and noticed a ton of duplicated comments.

During investigation I found this post from plugin author. It states, that plugin uses a separate table to store which comments are already added (avoiding duplicates). After checking my DB I found that there is no such table created (wp_comments_fbseo). Next thing I checked was plugin source code. Table SHOULD be created on activation (if it does not already exists), but it does not exists. Then I executed the query manually using phpMyAdmin and NO TABLE was created. The problem was in query. Continue reading

Flex mobile image-based ToggleButton skin

AIR 3.4 / Flex 4.6 does not provide Spark ToggleButton mobile skin.

So I took default Button mobile skin and modified it according ToggleButton needs. One of the requirements was ability to use images as button UI for each state. No borders, nor labels are needed, so related code was removed. Continue reading