Trylinux.org
 

August 26, 2008

OpenDNS.org and issues with Mac OSX

Filed under: General, apple, tips — admin @ 10:19 pm

I ran across a great site today for people with kids or just want to filter traffic on their network.  I have 3 kids and I just bought my 5 and 3 year old a macbook to share.  When I ran across http://OpenDNS.org I thought wow this would be a great time to do some filtering to keep them from coming across something they shouldn’t.

Use OpenDNS

It’s very simple to create an account and set it up since it is based on DNS.  Since it is based on DNS it is easy to work around, but I figure it will be a few years before my kids get to that point.

One issue I ran into though is their documentation for the Mac is based on a wired ethernet connection.  Who uses patch cables at home anymore?  Luckily I found a link to a site that shows how to get around this on the Mac.  You can read about hit here: http://qmail.jms1.net/djbdns/osx.shtml#dhcp-nameserver

April 4, 2008

Sorting a loop in bash and other possibilites

Filed under: bash, linux, tips — tip @ 4:15 pm

As I said in my previous post, I learned a couple things about bash today. I had a nice for loop that outputted the info I wanted, but not in the right order. I thought to myself, man if this were php I would just put it in an array and sort it before looping across it. I bet this will be a pain in bash.

BUT, I was pleasantly surprised to find out how simple this really was. If you want to perform an action the output of a loop in bash then you just pipe done into the fuction you want performed. See the example below.

for VAR in $VARS; do
{someaction}
done | sort -n

Cool, right?

Lineing up fields with BASH (or other programming languages)

Filed under: bash, linux, tips — tip @ 4:08 pm

Learned a couple things about bash today. I was wanting to print something out nicely, so I was using tabs to separate fields. As you know, nothing ever lines up if you do not have values very similar in size. So I was about to search Google for the problem when I had a moment of sheer brilliance. :) I thought I’ll just concatenate a bunch of spaces on the end of the variable and then use cut to grab how many characters I want. I was very proud of myself, but then bash quickly humbled me by condensing all my spaces I had added to the variable.

So, back to the all knowing Google. Turns out you have to quote your variable when you use it if you don’t want bash to truncate the spaces. So I quoted my variable when using it and all is good.

BUFFER="$VAR                                                                "
NICE_VAR=`echo "$VAR" | cut -c -15`
echo "$VAR $VAR2"

March 29, 2008

Move Oracle data files

Filed under: General, oracle, tips — tip @ 6:06 pm

The procedure below will allow you to move Oracle data and redo files.

1. It is a good idea to make a backup of the directory you are moving just in case something goes horribly wrong. :)
# cp -rp {data_dir} {backup_dir}

2. log in as the oracle user
# su -l oracle

3. move the database files
# mv {data_dir} {new_data_dir}

4. Set SID, log into database.
# export ORACLE_SID={ORACLE_SID}
# sqlplus /nolog
SQL> connect /as sysdba;

5. Create pfile from spfile
SQL> create pfile from spfile;

6. In another terminal, modify the newly created pfile. It is usually called init{SID}.ora and can be in different directories. Look in udump, dbs, and other directories until you find the newly created pfile. Check the date to make sure it is the one you are looking for. Now, fix the directories for the control_files variable.

7. Go back to the original terminal and create spfile from pfile;
SQL> create spfile from pfile;

8. Mount database.
SQL> startup mount;

9. Alter the database to look in the new location for the data files and redo logs. Below is an example. (Do this for all data and redo logs.)
SQL> alter database rename file ‘/home/oracle/oradata/{SID}/sysaux01.dbf’ to ‘/usr/local/app/oracle/oradata/{SID}/sysaux01.dbf’
SQL> alter database rename file ‘/home/oracle/oradata/{SID}/redo01.log’ to ‘/usr/local/app/oracle/oradata/{SID}/redo01.log’

10. Open database.
SQL> alter database open;

Now it should hopefully come up properly. You man want to shut it down and bring it up once more to make sure everything is working properly.

February 6, 2008

Dumping a mysql table to SQL

Filed under: General, linux, reminder, tips — tip @ 1:52 pm

I usually use phpMyAdmin to dump my table to SQL, but sometimes it is easier to do it from the command line. Use the following syntax to dump a table to SQL.

mysqldump -p -e -c --add-drop-table -r table.sql dbname table

Warning: The –add-drop-table will cause it to drop the existing table when you import.

You can import this with the command

mysql -p dbname < table.sql

December 14, 2007

yum repository from Dell

Filed under: General, linux, tips — tip @ 1:53 pm

I was thinking to myself it would be really great if Dell made available a yum repository for open manage. So I did a search and sure enough the do! This makes my job a lot easier :)

http://linux.dell.com/repo/hardware/

Also check out http://linux.dell.com/wiki/index.php/Repository/software
and http://linux.dell.com/wiki/index.php/Repository/firmware

December 12, 2007

yum upgrades tip

Filed under: General, linux, tips — tip @ 10:37 pm

When upgrading with yum I have started taking an rpm inventory before and after the upgrade.
Before Upgrade:

rpm -qa > BeforeUpgrade.txt

After Upgrade:

rpm -qa > AfterUpgrade.txt

Then I can compare them so that I know which packages were not upgraded and I can figure out why the did not upgrade.

cat BeforeUpgrade.txt AfterUpgrade.txt | sort | uniq -c | sort -n | grep "^\ *2"

October 22, 2007

Reboot a windows box from Linux

Filed under: linux, tips — tip @ 11:59 am

Occasionally I have the need to reboot a windows box from Linux. Here is the command I use to do this.
net -I {IP Address} -U Administrator rpc shutdown -r -f

The net command is part of the samba package and can be used for much more than rebooting, like adding or deleteing users, etc.  Read the man file for more info.

October 18, 2007

convert is awesome

Filed under: linux, tips, tools — tip @ 9:17 pm

Someone was asking how to convert PDFs to JPGs and I thought to myself, surely there is a Linux utility to do this. Well ImageMagick comes with a utility called convert and the syntax is really easy.

convert test.pdf test.jpg

This will create a jpeg for each page of the pdf.  Simple right?  Plus it supports many input and output formats.

October 5, 2007

Accessing MSSQL from PHP on Linux

Filed under: linux, php, tips — tip @ 3:33 pm

Need to access a MSSQL database from php on Linux? The remi repository has php-mssql and all the dependencies.  Look for the yum configuration link on the home page.  Very easy.

http://remi.collet.free.fr/

They also have a link to an IT asset management program called GPLI, I haven’t used it but the demo looks pretty nice.  The functionality seems to be there, but interface could use a little polishing, IMHO.

Next Page »