Archive for the ‘Documentation’ Category

Create Firefox policies in Windows Server 2008

I used the following procedure to be able to create and manage Firefox via Windows Server 2008 Group Policies. I used a solution provided by FrontMotion (http://www.frontmotion.com). I used the Firefox Community Edition which is Firefox packaged as an msi for deployment from an Active Directory. Use it for deployment, but instead wanted to manage Firefox browser setting via a Group Policy.

I started on my Windows 2008 Server, by download the firefox.adm (Administrative Template) from http://www.frontmotion.com/Firefox/firefox.adm.

Then from the Group Policy Management, clicked on “Group Policy Objects” and then “Default Domain Policy,” since I wanted to implement these policies for the entire domain. From here, click on the “Settings” tab, and right mouse click in the “Settings” windows pane and select “Edit.” This will bring up the “Group Policy Management Editor.”

Click to expand “User Configuration”/”Policies.” Note: You put this in the “Computer Configuration” as well.

Right mouse click “Administrative Templates: Policy definitions (ADMX files) retrieved from the local machine.” and select “Add/Remove Templates.”

Click “Add” and navigate to where you saved the firefox.adm you download earlier to add the adm.

This will add the Firefox policies to “User Configuration”/”Policies”/”Administrative Templates”/”Classic Administrative Templates.”

From here, you can set your policies. Such “Cache” and “Proxy Settings.”

When you are done, exit out of the “Group Policy Management Editor.”

From “Group Policy Management”, you should be able refresh (right mouse and hit “Refresh”) the “Default Domain Policy.” I closed “Group Policy Management” and re-opened it.

Once refreshed, you be able to see the new policies under “Default Domain Policy”/”User Configuration”/”Administrative Templates”/”Firefox.”

Now the policies are set.

Onto the client. As I mentioned before, I did not use the FrontMotion solution to deploy Firefox. I just installed the msi download from FrontMotion (http://www.frontmotion.com/Firefox/download.php?fileid=3652). Then, to test my policies, I logged in as a domain user. All of my policies were set.

Snow Leopard – Enable 64 bit

To enable the 64 bit kernel, hold the 6 and 4 keys while booting. Likewise, to enable the 32 bit kernel (if it is not your default), hold down the 3 and 2 keys while booting. By default, Snow Leopard has the 32bit kernel enabled to provide better application support until developers have ported their applications over to 64bit.

To permanently make the 64bit kernel your default enter the following from a Terminal session.

Update:
This didn’t work for me.
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.Boot ‘Kernel Flags’ ‘arch=x86_64’

However, this did:
nvram boot-args=”arch=x86_64″

To verify the kernel you are running, click on the Apple symbol in the top left corner and client “About this Mac.” Then, click “More Info…” and then Software. Look for the following:

64-bit Kernel and Extensions: Yes

If running the 32-bit kernel, it would read the following:

64-bit Kernel and Extensions: No

MacOSX – Burn a DMG or ISO image to disc.

Bring up the Disk Utility in Applications/Utilities.
Drag and drop the image file to the left window pane. The image file will be listed along with your other disk drives.
Click on the newly listed image file to select it in the Disk Utility.
Click on the Burn icon on the top toolbar.

MySQL Commands

I intend to add to this as I have time.

To display the schema of a table:

mysql> desc tablename;

To restore a database from backup:

mysql -u root -p
mysql> create database databasename;
mysql> use databasename;
mysql> source databasebackupfile;
Note: I back my databases up to a file name of databasename.sql.

To update all records in a column of a table:

mysql> update tablename set columnname=’value‘;

To update one record in a column of a table. Note: othercolumnname needs to be unique to the record.:

mysql> update tablename set columnname=’value‘ where othercolumnname=`somevalue‘;

To create an account:

GRANT ALL PRIVILEGES ON databasename.* TO ‘username‘@’hostname‘ IDENTIFIED BY ‘password‘;
GRANT ALL PRIVILEGES ON databasename.* TO ‘username‘@’localhost’ IDENTIFIED BY ‘password‘;
FLUSH PRIVILEGES;

To make mysqld listen only localhost:

vi /etc/my.cnf

bind-address=127.0.0.1

To count the number of rows in a table:

SELECT COUNT(*) FROM tablename;

To remove formatting and heading from a SELECT statement and delimit using a TAB character:

mysql mydatabase -N -B -u myuser -p -e “myselect statement;”

How to convert timestamp to date from a SELECT statement:

SELECT column1,DATE_FORMAT(FROM_UNIXTIME(`column2`), ‘%b %e %Y’) AS ‘date_formatted’ FROM tablename;

Here is a simpler example, where timestampcol is the name of date column you want to convert:

SELECT FROM_UNIXTIME(timestampcol) FROM tablename;

How to get the time an hour ago:

SELECT TIME(DATE_SUB(NOW(), INTERVAL 1 HOUR));

To access a MySql database from a script without having the password stored in the script:
Add the information to the .my.cny file in the user’s home directory that the script will run under.

Edit or create the file:

# vi ~/.my.cny

Protect the file:

# chmod 600 ~/.my.cny

Sample file contents:

# cat ~/.my.cny
[client]
user=mysqlusername
password=mysqlpassword
database=defaultdatabase

Then, to use it:

# mysql < mysqlscript > my.output

Display table information:

show table status from databasename;

How to backup one table:

# mysqldump -u mysqlusername -h mysqlhostname -p databasename tablename > tablename.sql

To search or output of a query. This would also apply to a SELECT statement.:
SHOW TABLES LIKE ‘%whatever%’;

To limit the number of rows:
SELECT * FROM mytableLIMIT 100;

To sort output based on a particular column:
SELECT * FROM mytable ORDER BY mycolumn DESC;

To get the size of a databse:
SELECT table_schema “Database Name”, SUM( data_length + index_length)/1024/1024
“Database Size (MB)” FROM information_schema.TABLES where table_schema = ‘mydatabase‘;

To get the size of all the tables in a database:
SELECT table_name “Table”, table_rows “Number of Rows”, round(((data_length + index_length)/1024/1024),2)
“Size of Table” FROM information_schema.TABLES WHERE table_schema = “mydatabase“;

To allow an account to export data to a file:
GRANT FILE ON *.* TO ‘username‘@’hostname‘;

Configure Finder to display the hidden files and directories.

From a Terminal session, type in the following:

To display hidden files:
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

To hide hidden files:
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

Sed to remove first or last character in a string.

To remove the first character in a string:
echo $STRING |sed ‘s/.\(.*\)/\1/’

To remove the last character in a string:
echo $STRING | sed ‘s/\(.*\)./\1/’

To remove the last five characters in a string:
echo $STRING | sed ‘s/\(.*\)…../\1/’

To remove all whitespace at the end of the line:
echo $STRING | sed ‘s/[ ]*$//’

Using hping to send a upd ping.

hping2 –udp -p portnumber ipaddress -d packetbodysize

Example:
I used the following to verify a DNS listening.

hping2 –udp -p 53 192.168.0.1 -d 50

Linux as print server for Tru64.

I used the following configuration to use a CentOS 5.3 server as a print server for Tru64. Note: I used this solution for testing purposes, because some Tru64 print jobs were stopping in the middle of the job, when the job was sent directly to the printer.

On the CentOS server, I had a printer set up and working via CUPS. I started cups-lpd by using ntsysv and service xinetd reload.

On the Tru64, I created an /etc/printcap entry similar to the following:

printname:\
:lf=/usr/adm/printernameerr:\
:lp=:\
:rm=remoteprinterserver:\
:rp=remoteprintername:\
:sh:\
:sd=/usr/spool/remote/printername:

Example:
myprinter:\
:lf=/usr/adm/myprintererr:\
:lp=:\
:rm=mylinuxprintserver:\
:rp=mylinuxprinter:\
:sh:\
:sd=/usr/spool/remote/myprinter:

Bash: Input from multiple files.

exec 3<$1 4<$2 while read file1 <&3 && read file2 <&4 do code
done

Rsyslog: remote logging

On the client you want to log from:
vi /etc/rsyslog.conf

*.* @RemoteSyslogIPAddress:Port

Example:
*.* @172.18.1.50:514

On the remote logging server:
vi /etc/rsyslog.conf

# Begin – Allow remote logging
$ModLoad imudp.so
$UDPServerRun 514
# End – Allow remote logging

Need to send a HUP to the rsyslogd process or

service rsyslog reload

Return top

INFORMATION