NFSV4 does id comparisions, eg user and uid must be the same across hosts or it will automaticly map the file to owner nobody. This can be changed through configuration files and the like.

Easy win is to make sure both boxes are part of the same DNS domain in /etc/idmapd.conf you want domain = domain.com if dns resolution is flaky.

But i found a big pain was that i fixed the mismatched UID’s and i could not get it to accept the update.

I restarted NFS countless times, remounted the mount countless times and so on.

Of course nfs does some form of caching that isnt cleared by a restart

To clear the cache
nfsidmap -c

gawk ‘{if(~ /\.tar/){lasttar=}; if(~ /^filenamehere\.jpg$/){print lasttar; exit;}}’ < internat.txt

I cant take any credit for this script, I took the orginal from the solar.js.cx page and changed it to meet my requirements.
Here is my version

#!/usr/bin/perl
############################################
## This software is licensed under the LGPL.
## Visit http://solar.js.cx for more info.
############################################
use Device::SerialPort;
use LWP::UserAgent;
use Time::Local;
use HTTP::Status qw(:constants :is status_message);
$debug = 0;
$submit = 1;
$serial_port = "/dev/ttyr00";
$pvoutput_api ="<apikeyhere>";
$pvoutport_systemid = "<systemkeyhere>";

$serial_lock = "/tmp/ttyr00.lock";

## Wait until unlocked
while (-e $serial_lock)
{
  sleep (1);
}
$serial_port = new Device::SerialPort ($serial_port, "", $serial_lock);

$serial_port->baudrate(9600)				|| die "failed setting baudrate";
$serial_port->parity("none")				|| die "failed setting parity";
$serial_port->databits(8)				|| die "failed setting databits";
$serial_port->handshake("none")				|| die "failed setting handshake";
$serial_port->write_settings				|| die "no settings";

## Might need to tweak this if data is truncated.
$serial_port->read_const_time(40);

$serial_port->write("INV?\r");
($count, $xantrex_status) = $serial_port->read(255);
$serial_port->write("KWHTODAY?\r");
($count, $xantrex_kwhtoday) = $serial_port->read(255);
$serial_port->write("TIME?\r");
($count, $xantrex_time) = $serial_port->read(255);
$serial_port->write("POUT?\r");
($count, $xantrex_pout) = $serial_port->read(255);

$serial_port->close || warn "close failed";

$xantrex_wtoday =  $xantrex_kwhtoday * 1000;
#$time = timelocal($sec,$min,$hour,$mday,$mon,$year);
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$mon += 1;
$date = sprintf "%04d%02d%02d", $year,$mon,$mday;
$ptime = sprintf "%02d:%02d", $hour, $min;

if ($debug == 1) {
	print "Current date/time is: $date - $ptime\n";
	print "Current inverter status is: $xantrex_status\n";
	print "Total KWH today is: $xantrex_kwhtoday\n";
	print "Total WH today is: $xantrex_wtoday\n";
	print "Current output is: $xantrex_pout\n";
}
chomp($xantrex_status);
my $length = length($xantrex_status);
$length -=1;
$status = substr $xantrex_status, 0, $length;
if (($submit == 1)  && ($status eq "ON")) {
	if ($debug == 1) {
		print  "Submitting data\n";
	}
	my $ua = new LWP::UserAgent;
	$ua->default_header( 'X-Pvoutput-Apikey' => $pvoutput_api, 'X-Pvoutput-SystemId' => $pvoutport_systemid );


	my $response 
	= $ua->post('http://pvoutput.org/service/r2/addstatus.jsp', 
	{ 'v2' => $xantrex_pout, 
	 'v1' => $xantrex_wtoday,
	 'd' => $date,
	 't' => $ptime
	  
	});
	my $content = $response->content;
	if ($debug == 1) {
		print "$content\n";
	}
	if ($response->is_error) {
		print "Error updating pvoutput.org $content\r\n";
	}
}

At $WORK2$ we had the express need to migrate from Asterisk 1.6 to 1.8. We are running Debian squeeze which only provides 1.6.9 as its stable version,which is fine, but when you have a bug that requires vendor support you get forced to upgrade. I didnt really want to rebuild packages from source (i hate building from source on a package managed system).

I discovered that asterisk provides its own debian/ubuntu repository for its packages which is awesome, so on our test box we quickly deployed it. And then during testing we ran into a snag. Namely that its next to impossible to find instructions on how to get the format_mp3.so module for mp3 support. In Debian its packaged with it, but due to some licensing who-ah asterisk doesnt ship them. i tried copying an older copy, and one out of the Debian squeeze repository but it wouldn’t load cause it was built with different compile time options.

After much reading and playing arround, i worked out how to build that module.. ANd since it took me the better part of a night to work it out, heres how i did it ­čÖé

Grab everything required to build the source for asterisk, some other libraries, the build tools, the actual source, and then configure it for our system.

apt-get install build-essential
apt-get build-dep asterisk
apt-get install libncurses5-dev libncursesw5-dev libxml2-dev
cd /usr/src
apt-get source asterisk
cd asterisk-1.8.11.1
./configure
make menuselect

In the make menu select, go into addons, and tick off format_mp3 (i think x was save and exit)

contrib/scripts/get_mp3_source.sh

This goes and grabs out of SVN the latest mp3 stuff, this is done for the packaging stuff as mentioned above

make addons

Assuming your make addons ran without errors, its built the module.. to install it run:
make addons-install
Now to restart asterisk
/etc/init.d/asterisk restart
and finally to confirm it actually loaded
asterisk -rx 'core show file formats'

as long as mp3 is in your list, your golden!

Notes from when i set up log shipping over the internet.. to be padded out with real deatil later.

Create vpn between servers (use remote access and routing, and create the other server as a peristant dial on demand route)

Make user say “sqlserver_agent” on both servers, with same username and same password.
Make directory on primary server eg c:\database_logs
grant access to both “sqlserver_agent” and “network service”
share path on primary server.

create log destination folder on secondary server eg “c:\database_restore_logs” make sure both “network service” and “sqlserver_agent” can read/write to it

make sql server agent on both run servers with the same account as above.

make sure database on primary server is in full mode.
back up database to share, and manually copy it across. manually restore it on the other site, but leave it in standby mode (had to do the manual copy since sqlserver.exe isnt running as the service account, and therefor couldnt access the network share where it was living on. only the agent could)

use the wizard to create the jobs on both servers that do the restore.

my wizard for some reason created the job with the wrong hostname and the sqllogship.exe command couldnt talk tot he server, so had to edit it from the wierd windows hostname that it had and change it to the ip of the host. using the correct hostname probably would have worked as we..

the user “network service” has no access over the network to do fuck all. dont use it for trying to communicate to other hosts.. i tried enabling guest, adding network service to all the shares, enabling everyone, and a whole lot of other things.. just create a service account on both servers with the same details and that will work just fine!!

used these sites for info
http://www.mssqltips.com/sqlservertip/2562/sql-server-log-shipping-to-a-different-domain-or-workgroup/
http://omaralzabir.com/how_to_setup_sql_server_2005_transaction_log_ship_on_large_database_that_really_works/

I used to have an encrypted volume on my file server, for storing sensitive things, but after an upgrade to the newest version of Debian, that stopped working. So after some mucking around and getting the old module for cryptoloop put back into my current kernel, I figured i might as well migrate over to the newer version, which uses cryptsetup, losetup, and luks.

Ive shamelessly stolen these commands (although ive changed some of them)from elsewhere..

Create the file system and restricted access.

dd of=/path/to/secretfs bs=1G count=0 seek=8
chmod 600 /path/to/secretfs

Create a loopback device for the file
losetup /dev/loop0 /path/to/secretfs
Creates the volume, asks you for the key, and then creatss the DM mapping
cryptsetup -y luksFormat /dev/loop0
cryptsetup luksOpen /dev/loop0 secretfs

Pad the file so it generates its random data
dd if=/dev/zero of=/dev/mapper/secretfs

Create the filesystem
mkfs.ext3 dev/mapper/secretfs

# Mount the new filesystem in a convenient location
mkdir /mnt/cryptofs/secretfs
mount /dev/mapper/secretfs /mnt/cryptofs/secretfs

And an encrypted volume is setup.

Now how to unmount:

umount /mnt/cryptofs/secretfs
cryptsetup luksClose secretfs
losetup -d /dev/loop0

Remount:

losetup /dev/loop0 /path/to/secretfs
cryptsetup luksOpen /dev/loop0 secretfs
(enter password when prompted)
mount /dev/mapper/secretfs /mnt/cryptofs/secretfs

Now stuff that i can never remember how to do is grow the volume.

Make sure the volume is closed, unmounted etc.
umount /mnt/cryptofs/secretfs
cryptsetup luksClose secretfs
losetup -d /dev/loop0

Add 20gig to the file
dd if=/dev/zero bs=1G count=20 >> /dev/mapper/secretfs

Remount and reopen part of it

losetup /dev/loop0 /path/to/secretfs
cryptsetup lucksOpen /dev/loop5 EncryptedFS

check the FS first
e2fsck -f /dev/mapper/EncryptedFS

once thats done grow it
resize2fs /dev/mapper/EncryptedFS
and your done. You can now open the volume for use

Backed up and restored a database the other day, but of course the network users arent setup properly cause there actually stored in the master database..

So i recreate the user on the instance which is fine , and then try and regrant it permissions on the database but it fails because its already there…

To fix…

User DATABASE
EXEC sp_change_users_login 'update_one', 'usernamehere', 'usernamehere''

http://msdn.microsoft.com/en-us/library/ms174378.aspx

I wanted to pull my iphone backups apart because i accidentally deleted some stuff but didn’t want to restore it all and play with it that way.

So heres the tools and what i needed to do it:
Backups are stored at: ~/Library/Application Support/MobileSync/Backup) or on a PC (c:\Documents and Settings\Application Data\Apple Computer\MobileSync\Backup).

Iphone backup extractor for OSX
how-to-save-and-read-your-iphone-text-messages-on-your-computer
how-to-recover-your-iphone-files-photos-contacts-notes-sms-call-history-etc

Couldnt work out how to pull up previous backups though.. only the latest one.. which is a pain..

Shorter emails are better.. apparently

Rounds Timefieldhere to the nearest 5 minutes..

trunc(timefieldhere,'dd') + round(to_char(timefieldhere,'sssss') / 300) / 288)

Next Page »