greynode » linux http://greynode.org ingĂ©nierie de tous les aspects de vie Fri, 15 Apr 2011 16:12:00 +0000 en hourly 1 http://wordpress.org/?v=3.1.1 Why No Games on Linux? http://greynode.org/2010/05/11/why-no-games-on-linux/ http://greynode.org/2010/05/11/why-no-games-on-linux/#comments Tue, 11 May 2010 20:54:26 +0000 enum http://blog.greynode.org/?p=226 Thought I would share an interesting article on why there are no games on linux. Want more games on linux? Solve these problems!

]]>
http://greynode.org/2010/05/11/why-no-games-on-linux/feed/ 0
pdnsd and NetworkManager http://greynode.org/2010/05/09/pdnsd-and-networkmanager/ http://greynode.org/2010/05/09/pdnsd-and-networkmanager/#comments Mon, 10 May 2010 07:52:55 +0000 enum http://blog.greynode.org/?p=211

Read the rest of this entry »

]]>
If you run arch linux or a similar minimal distro, you may be familiar with the local dns server pdnsd, used to cache DNS queries. If you try to run pdnsd on the same computer as NetworkManager, you may run into a problem. Using default configurations, your DNS lookups end up in a vicious loop redirecting to 127.0.0.1. To circumvent this problem, I did the following.

I let NetworkManager generate my /etc/resolv.conf file. I then copied it to /etc/resolv.conf.head. Once this was done, the server section in /etc/pdnsd.conf was edited to contain the following:

server {
label= "comcast;
file = "/etc/resolv.conf.head"; # Preferably do not use /etc/resolv.conf
# proxy_only=on; # Do not query any name servers beside your ISP's.
timeout=4; # Server timeout; this may be much shorter
# that the global timeout option.
uptest=if; # Test if the network interface is active.
interface=wlan0; # The name of the interface to check.
interval=10m; # Check every 10 minutes.
purge_cache=off; # Keep stale cache entries in case the ISP's
# DNS servers go offline.
}

Notice the file variable which tells pdnsd where to find the nameservers it will query. Once this is complete, the pdnsd daemon can be restarted. Now, NetworkManager must be told to use localhost for DNS lookups. This can be done by right-clicking the nm-applet icon and configuring the wireless for “Automatic (DHCP) Address Only”, and enter 127.0.0.1 as the DNS server. Once this is complete, you can test it with the following commands:

jaigner /var/cache $ dig kernel.org | grep Query
;; Query time: 75 msec
jaigner /var/cache $ dig kernel.org | grep Query
;; Query time: 0 msec

The second time the command was called, the cached result was fetched. If your Query time is greater than 1ms, it is likely that something is misconfigured.

]]>
http://greynode.org/2010/05/09/pdnsd-and-networkmanager/feed/ 0
Replace Text Recursively with sed http://greynode.org/2009/06/17/replace-text-recursively-with-sed/ http://greynode.org/2009/06/17/replace-text-recursively-with-sed/#comments Wed, 17 Jun 2009 20:53:31 +0000 enum http://www.greynode.org/?p=45

Read the rest of this entry »

]]>
Here is a quick little trick I discovered today when I needed to replace text in multiple files recursively:

grep -rl -e <searchterm> * | xargs sed -i .bak 's/searchterm/newterm/i'

There might be a problem with files that have spaces in the names (because xargs will take a space as the start of a new argument). To solve this problem, you should be able to do something like this:

grep -rl --null -e <searchterm> * |
xargs -0 sed -i .bak 's/searchterm/newterm/i'

If you are using GNU grep, you could also use -Z instead of –null. I happen to be using the BSD version of grep, so -Z isn’t an alias for –null.

]]>
http://greynode.org/2009/06/17/replace-text-recursively-with-sed/feed/ 0