Category: Software

Quick bash script to restore all OpenVZ dumps

By , October 5, 2011 10:57 pm

This script will read the container ID from the file name, and use it to restore the tgz dump to the same ID on the new OpenVZ/Proxmox server.

Note that this only works if the default name for the vzdumps is kept, and it only works for the next 89 years, because I’m lazy.

Thanks to
http://www.cyberciti.biz/faq/bash-loop-over-file/ and http://bashcurescancer.com/10-steps-to-beautiful-shell-scripts.html

#!/bin/bash
VZDUMPS=/path/to/backups/*.tgz
for f in $VZDUMPS
 
do
        f2=${f#*openvz-}
        VEID=${f2%-20*}
        echo "Restoring $f to $VEID"
        vzrestore $f $VEID
done

Add Google search provider to IE or Firefox

By , October 2, 2011 3:08 pm

Use this link to add the default Google search provider to IE or Firefox. Useful for IE, or Firefox on Linux Mint.
For Firefox:Google.xml

For IE: MS-Google.xml

CNet Download.com hosting adware/malware

By , September 23, 2011 12:29 pm

I had noticed this a little while ago, but it seems they’re stepping it up.

Seriously, does CBS have no better revenue generation method than to install crapware on people’s computers?

See for example Pidgin Portable: http://download.cnet.com/Pidgin-Portable/3000-2150_4-10834880.html?tag=mncol;3

and this post on UltraVNC forums

https://forum.ultravnc.net/viewtopic.php?f=6&t=28692

How to recursively delete files matching a pattern

By , September 13, 2011 9:45 am

cd to the folder, run :

$ find . -name '*attach*' | xargs rm

where attach is the keyword present in all filenames to delete.

3 monitors and Updated xorg mesa drivers for Ubuntu Natty

By , September 9, 2011 2:34 pm

I’m currently running Ubuntu Natty as my primary OS at work.

My setup is a Precision T3500 workstation that came with two NVIDIA Quadro cards which were a nightmare for Linux support. I heard that ATI cards supported 3 monitors on one card, as long as one of them was DisplayPort. I saw a cheap Radeon HD 5450 on sale for about $40, so I picked it up only to notice that it had an HDMI port instead of DisplayPort. I figured I’d try it anyway and was surprised to find that with the open-source radeon driver, 3 monitors work! One is connected by VGA, one HDMI and one DVI.

I had, however been experiencing random X crashes, and I suspect the problem was with the radeon driver.

Currently testing out some updated xorg drivers found at:

http://phoronix.com/forums/showthread.php?50038-Updated-and-Optimized-Ubuntu-Free-Graphics-Drivers

 

My system specs:

$ sudo lshw -short
H/W path         Device      Class       Description
====================================================
                             system      Precision WorkStation T3500 ()
/0                           bus         09KPNV
/0/0                         memory      64KiB BIOS
/0/400                       processor   Intel(R) Xeon(R) CPU           W3530  @ 2.80GHz
/0/400/700                   memory      256KiB L1 cache
/0/400/701                   memory      1MiB L2 cache
/0/400/704                   memory      8MiB L3 cache
/0/1000                      memory      14GiB System Memory
/0/1000/0                    memory      2GiB DIMM DDR3 1333 MHz (0.8 ns)
/0/1000/1                    memory      2GiB DIMM DDR3 1333 MHz (0.8 ns)
/0/1000/2                    memory      2GiB DIMM DDR3 1333 MHz (0.8 ns)
/0/1000/3                    memory      4GiB DIMM DDR3 1333 MHz (0.8 ns)
/0/1000/4                    memory      4GiB DIMM DDR3 1333 MHz (0.8 ns)
/0/1000/5                    memory      DIMM DDR3 Synchronous [empty]
/0/100                       bridge      5520/5500/X58 I/O Hub to ESI Port
/0/100/1                     bridge      5520/5500/X58 I/O Hub PCI Express Root Port 1
/0/100/1/0       eth0        network     82574L Gigabit Network Connection
/0/100/3                     bridge      5520/5500/X58 I/O Hub PCI Express Root Port 3
/0/100/3/0                   display     Cedar PRO [Radeon HD 5450]
/0/100/3/0.1                 multimedia  Manhattan HDMI Audio [Mobility Radeon HD 5000 Series]
/0/100/7                     bridge      5520/5500/X58 I/O Hub PCI Express Root Port 7
/0/100/14                    generic     5520/5500/X58 I/O Hub System Management Registers
/0/100/14.1                  generic     5520/5500/X58 I/O Hub GPIO and Scratch Pad Registers
/0/100/14.2                  generic     5520/5500/X58 I/O Hub Control Status and RAS Registers
/0/100/1a                    bus         82801JI (ICH10 Family) USB UHCI Controller #4
/0/100/1a.1                  bus         82801JI (ICH10 Family) USB UHCI Controller #5
/0/100/1a.2                  bus         82801JI (ICH10 Family) USB UHCI Controller #6
/0/100/1a.7                  bus         82801JI (ICH10 Family) USB2 EHCI Controller #2
/0/100/1b                    multimedia  82801JI (ICH10 Family) HD Audio Controller
/0/100/1c                    bridge      82801JI (ICH10 Family) PCI Express Root Port 1
/0/100/1c.5                  bridge      82801JI (ICH10 Family) PCI Express Root Port 6
/0/100/1c.5/0    eth1        network     NetXtreme BCM5761 Gigabit Ethernet PCIe
/0/100/1d                    bus         82801JI (ICH10 Family) USB UHCI Controller #1
/0/100/1d.1                  bus         82801JI (ICH10 Family) USB UHCI Controller #2
/0/100/1d.2                  bus         82801JI (ICH10 Family) USB UHCI Controller #3
/0/100/1d.7                  bus         82801JI (ICH10 Family) USB2 EHCI Controller #1
/0/100/1e                    bridge      82801 PCI Bridge
/0/100/1f                    bridge      82801JIR (ICH10R) LPC Interface Controller
/0/100/1f.2      scsi0       storage     82801JI (ICH10 Family) SATA AHCI Controller
/0/100/1f.2/0    /dev/sda    disk        250GB ST3250318AS
/0/100/1f.2/0/1  /dev/sda1   volume      101MiB Linux filesystem partition
/0/100/1f.2/0/2  /dev/sda2   volume      4102MiB Linux swap volume
/0/100/1f.2/0/3  /dev/sda3   volume      20GiB EXT4 volume
/0/100/1f.2/0/4  /dev/sda4   volume      208GiB EXT4 volume
/0/100/1f.2/1    /dev/sdb    disk        1500GB WDC WD15EARS-00M
/0/100/1f.2/1/1  /dev/sdb1   volume      499GiB Data partition
/0/100/1f.2/1/2  /dev/sdb2   volume      897GiB Data partition
/0/100/1f.2/2    /dev/cdrom  disk        DVD-ROM TS-H353C
/0/100/1f.2/3    /dev/cdrw   disk        DVD+-RW TS-H653F
/0/100/1f.2/3/0  /dev/cdrw   disk        
/0/100/1f.3                  bus         82801JI (ICH10 Family) SMBus Controller

Removing PulseAudio from Ubuntu 11.04

By , August 18, 2011 2:58 pm

PulseAudio, as usual, has been annoying me.

This time, it’s because it’s blocking the S/PDIF passthrough via HDMI from XBMC.

I found a great tutorial on how to disable it at http://www.jeffsplace.net/node/12.

However for some reason I had no sound from the TV. That’s because the default device for ALSA is the analog audio output rather than the HDMI port. To fix this, run aplay -l in terminal to determine the card ID for the HDMI out.

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Then, create a ~/.asoundrc file with the following:

pcm.!default "plughw:0,3"

Where 0 is your card ID and 3 is the device ID found from the aplay -l.

Now all apps should be able to play audio through ALSA/HDMI.

 

yer -ao alsa -ac hwdts -vo vdpau qgh_dts.dts

/Extra Kext pack for 10.6.7 on Dell Latitude D620

By , July 25, 2011 10:49 pm

D620-Extra.tar.bz2

This is more for my own use, but if it helps anyone, great!

This is the set of kexts I use in the /Extra folder of my Dell D620 with Intel GMA950 video and Broadcom b/g wlan card. Latest addition was the AppleBCM5751Ethernet.kext which finally got me working ethernet.

Now to try the 10.6.8 update…

The kindergarten browser wars

By , June 25, 2011 11:15 pm

A friend posted this on Facebook today:

Quite an accurate depiction.

Image credit: The Shoze Blog

ATI/AMD Radeon HD cards in Mac Pro

By , June 23, 2011 9:40 pm

Update: Just went and exchanged the HD 6450 for an HD 6670. This one works great, runs Starcraft II on High and doesn’t crash the machine!

After some discussion with a coworker, I decided to try putting a Sapphire Radeon HD6450 into my Mac Pro, since the 8800GT was a real power hog and heater.

Just my luck that today the 10.6.8 update was released, containing – you guessed it – HD6xxx drivers!

So I ran the update, then popped in the HD6450, and what do you know, it works! Only two problems: First, no EFI support which means no boot screen (white/grey apple). Second, it seems to crash when launching any game. I tried Lord of the Rings: Return of the King and Starcraft II, and both caused the screen to go blank and kernel panic.

Anyway, nice experiment, and at least it works for regular desktop work….

For anyone interested, here are all the Radeon HD6000 series cards supported by the 10.6.8 kexts, IDs and names.

  • 0×67681002  CAICOS 6450M
  • 0×67701002  NI CAICOS [AMD Radeon HD 6400 Series]
  • 0×67791002  NI Caicos [AMD RADEON HD 6450]
  • 0×67601002  NI Seymour [AMD Radeon HD 6470M]
  • 0×67611002  NI Seymour [AMD Radeon HD 6430M]
  • 0×67501002  Turks [AMD Radeon HD 6500 series]
  • 0×67581002  Turks XT [AMD Radeon HD 6600 Series]
  • 0×67591002  NI Turks [AMD Radeon HD 6500]
  • 0×67401002  Whistler XT [AMD Radeon HD 6700M Series]
  • 0×67411002  NI Whistler [AMD Radeon HD 6600M Series]
  • 0×67381002  Barts XT [ATI Radeon HD 6800 Series]
  • 0×67391002  Barts PRO [ATI Radeon HD 6800 Series]
  • 0×67201002  Blackcomb [AMD Radeon HD 6900M Series]
  • 0×67221002 ATI Radeon HD 6950
  • 0×67181002  Cayman XT [AMD Radeon HD 6900 Series]

Configuring multiple static IP interfaces in Arch Linux (netcfg)

By , June 22, 2011 2:29 pm

Being a long-time Ubuntu/Debian user, I’m used to editing the good ol’ /etc/network/interfaces file to configure network interfaces.

Recently, trying Arch Linux, I discovered that networking isn’t always that simple.

Most basic system parameters in Arch are configured in the /etc/rc.conf file. However, that file is limited to configuring one static wired ethernet connection.

In order to configure multiple interfaces, you need to install the netcfg package and create profiles for each NIC in /etc/network.d :

There are some examples provided, however none of them mention how to set a custom netmask or multiple DNS servers. So here are my two network profiles:

interface 1

CONNECTION='ethernet'
DESCRIPTION='Static IP WAN'
INTERFACE='eth0'
IP='static'
ADDR='172.32.24.108'
GATEWAY='172.32.24.1'
DNS=('172.16.24.1' '172.16.24.3')

interface 2

CONNECTION='ethernet'
DESCRIPTION='Static IP LAN'
INTERFACE='eth1'
IP='static'
ADDR='192.168.2.80'
NETMASK='255.255.254.0'

Once the profiles are created, go back to the /etc/rc.conf and make them activated at boot. The values for the NETWORKS array are the two files previously created in /etc/network.d:

# Enable these netcfg profiles at boot-up. These are useful if you happen to
# need more advanced network features than the simple network service
# supports, such as multiple network configurations (ie, laptop users)
#   - set to 'menu' to present a menu during boot-up (dialog package required)
#   - prefix an entry with a ! to disable it
#
# Network profiles are found in /etc/network.d
#
# This requires the netcfg package
#
NETWORKS=(interface1-static interface2-static)

# -----------------------------------------------------------------------
# DAEMONS
# -----------------------------------------------------------------------
#
# Daemons to start at boot-up (in this order)
#   - prefix a daemon with a ! to disable it
#   - prefix a daemon with a @ to start it up in the background
#
# If something other takes care of your hardware clock (ntpd, dual-boot...)
# you should disable 'hwclock' here.
#
DAEMONS=(hwclock syslog-ng net-profiles sshd netfs crond dbus @cups kdm)

Custom theme by me. Based on Panorama by Themocracy

Your object is to save the world, while still leading a pleasant life.