Share list of files in DropBox Public folder

For Windows DropBox users. Here is a simple way to share list of links for your Public folder. This script doesn’t show files in sub-directories.

1. Create a makefilelist.bat file with script to list all files in directory.
2. Use Scheduled Tasks to run the .bat file Daily or Weekly, etc as needed; depending on how often you update files in DropBox Public.
3. Share the list file with “Copy Public Link”.
4. Open Public Link in a browser. You know have a list of all public files that is up-to-date.

You can see an example and download the makefilelist.bat file here:
http://dl.dropbox.com/u/4355901/index.html

Posted in quickfire | Tagged | 1 Comment

Asterisk GotoIf Application

The description from asterisk for this is GotoIf(condition?[labeliftrue]:[labeliffalse]), however for me (being somewhat new to asterisk, and not fully understanding all the little bits, this was a bit confusing. A better way of describing this, at least for those of use new to asterisk, might be GotoIf(condition?[context,priority,labeliftrue]:[context,priority,labeliffalse]).
I have not used labels in the dial plan before, and when starting out with this application I read label to be a context. This lead me to write my dial plan similar to this..


[default]
exten => 100,1,GoToIf(condition?true,false)


[true]
exten => s,1,...
[false]
exten => s,1,...

In retrospect, it’s obvious what the documentation is saying, but as I said, not being familiar with labels, I was a bit lost.

Posted in quickfire, tips | Tagged | Leave a comment

Remote packet capture

Had a need to capture some traffic on the remote machine and analyze it in Real Time ™.  Found to solutions to this.  The first, involved just sending the output of tcpdump across the ssh session.

ssh host.example.org tcpump - eth0 -w - > capture.pcap

The other method, picked up from the wireshark wiki allows for the captured traffic to be viewed as it’s being captured in wireshark.  This is done using a combination of ssh and a fifo pipe.  The exact command can very slightly, and I suggest reading the relevant man pages, but something similar to the following (taken from their wiki) should do the trick.

mkfifo /tmp/pipe
ssh user@remote-host "tshark -w - not port 22" > /tmp/pipe
wireshark -k -i /tmp/pipe

Posted in Uncategorized | Leave a comment

Unable to use pvmove

I needed to remove a physical volume from a LVM volume group, and found this is done using the pvmove command.  However, trying to run this, resulted in an immediate, and suprising error

# pvmove /dev/sdb1 /dev/sdc1
Required device-mapper target(s) not detected in your kernel

After some quick google’ing I found on this list a cause, and a fix.  Appreantly, pvmove uses something provided by the raid1 module to do it’s magic.  So, loading loading the dm-mirror kernel module fixes the issue and pvmove works as expected.  Thanks debian-user list :-)

Posted in Uncategorized | Leave a comment

Quick install of Tomcat5 on CentOS

At the office, we’re in the process of doing some work where we need a tomcat server.  Without having to get into things to much, I found this simple method for getting tomcat5 up and running pretty quickly.  I’m sure I’ve left out some important things, and I’m doubtful as to how production ready this is, but for our testing, it’s working out fine.

I’m using CentOS 5.3 for all of this, but I’m sure it will work with CentOS 5.4

yum install tomcat5 tomcat5-admin-webapps tomcat5-webapps

After this, you need to edit the tomcat-users.xml file to create a new user.Using the above, this file ends up in /etc/tomcat5/tomcat5-users.xml and all that needs to be added is a line similar to the following..

user username="admin" password="p@ssw0rd" roles="admin,manager"

I can’t get wordpress to work with me on this, so you’ll need to wrap the above in angle brackets, the same as all the other lines in that file.
You can set username and password to whatever you’d like. After this, restart tomcat (not sure if this is needed) with service tomcat5 restart and off you go.

Posted in quickfire, tips | Tagged , | Leave a comment

Burn ISO from command line in Linux

Quick and simple way of burning an ISO image from the command line in Linux.  First, find your devices with wodim, the use the cdrecord command to burn the ISO image.

$ wodim --devices
wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
 0  dev='/dev/scd0'	rwrw-- : 'LITE-ON' 'DVDRW LH-20A1P'
-------------------------------------------------------------------------
$ cdrecord -v dev='/dev/scd0' Download/archlinux-2009.08-netinstall-i686.iso

Then, you’re done.

Posted in quickfire | Tagged | Leave a comment

Launch Google Chrome and external links with incognito mode.

The instructions floating around are to place the --incognito switch (single – works fine for me) in your desktop shortcut. But sometimes you may be in an application like Tweek Deck, etc that links to webpages. These pages don’t launch in incognito if you only fix your desktop shortcut. Here is how to do both. Google Chrome is set as the default browser in this case.

(These instructions are based off of Windows XP)

Right-click on your Chrome shortcut. Choose Properties. Add -incognito to the end:

chrome.exe" --incognito

To launch all web shortcuts and links from your system:
Control Panel > Folder Options > File Types
Select the File Type URL:HyperText Transfer Protocol and choose Advanced
Select action open and edit.
Just like before add the switch to the end like this:

chrome.exe" --incognito -- "%1"

Edit: After more digging in Google I found this tip mentioned in Google Code Chromium issues (Comment 3).

Posted in quickfire, tips | Tagged , | Leave a comment

Remove bonded interface in OpenFiler

I decided to try and use NIC bonding in OpenFiler and while things seemed to go well at first, I did run into some issues over time.  I’m still in the process of testing, and I think most of the issues are “user error” and not so much problems with NIC bonding or OpenFiler itself.  More on that later.

I was able to configure a bonded interface, and add both interfaces to it.  However, after the issues started, I wanted to remove the bond.  There is no way of doing this from within the Web UI it seems.  Easiest solution, login to the console, and delete /etc/sysconfig/network-scripts/ifcfg-bond0 if you’re using the first bond interface.

After this file is deleted, service network restart should get you going again.

Posted in tips | Tagged | Leave a comment

Find Text and Find/Replace Easier Than You Think in Linux

How to search all files for a text string:

grep -lr string ./ > results.txt

-l will print only the path and file names of the matches.

Search all files of a certain name for a certain string:

grep -lr string ./ | grep filename

Yes, do specify ./ if you are doing all directories within current.

(source and more info)

Find an replace a string in files:
Searching for a way to do this usually leads me to finding fancy scripts that don’t work right, are scary (create temp files, etc) or aren’t recursive. Just have backups at hand and test the following combination of find and sed before unleashing it, because it works great! You can test it by replacing sed with grep

find ./ -type f -exec sed -i ’s/string1/string2/’ {} \;

Within specific file names/extentions…

find ./ -iname \*.htm\* -exec sed -i 's/\-2005/\-2007/g' {} \;

Don’t forget to use escape \ as seen above. And if your strings contain forward slash / just use a different delimiter such as pipe | or escape it.

You can also install rpl, as shown in the source pdf, for even cleaner line of code for executing your find and replace.

(source and more info) A nice pdf to keep by your side.

Posted in quickfire, tips | Tagged , , , , , | 1 Comment

Open Source storage server

This is not going to be a full review, but more a general take on things.

Since moving from VMware Server to ESXi to host my virtual machines, I’ve been very interested in looking into some more of the advanced features of ESX and ESXi yet most of these require iSCSI.  I remember from a few years back using Openfiler to do some simple samba file sharing, and remembered it supported iSCSI as one method of giving out storage.

Now, I’ve yet to use any of the features of ESX that require iSCSI, or even setup Openfiler to export storage via iSCSI, but I have been using it for simple file sharing and must say I’m quite impressed.

Setup is a breeze, taking about 20 minutes on an older PC. Management is done almost entirely through a web interface, that is very easy to use.  Unlink many of the other appliance packages out there, the web interface is very simple and straight forward.  Very much impressed with that.

Over the next few months I’ll be exploring Openfiler much more, and hopefully getting into some of it’s more advanced features including interface bonding, md devices and clustering.  I plan to keep updating as things more along.

Posted in other, projects | Tagged , , , , | Leave a comment