Mar 10 2010

List only directories on the command-line or in your scripts.

Category: Computers, Developmentmariusvw @ 11:53 am

Here you have some different ways of showing only the directories on a path you specify.
This can be used in different other languages such as PHP with shell_exec for example.

ls -l /shares/ | grep "^d" | awk '{ print $9 }'
find /shares/ -maxdepth 1 -mindepth 1 -type d | sed 's/.\///g'
find /shares/ -maxdepth 1 -mindepth 1 -type d | perl -pi -e 's/.\///g'
find /shares/ -maxdepth 1 -mindepth 1 -type d | grep -v '^\./\.'

I hope you find them useful on some way :-)
Of course comments are more than welcome!

  • Share/Bookmark

Tags: , , , , , , , ,


Mar 09 2010

Found an old image of a pipe I made… Toke ‘n smoke.

Category: Home, Livingmariusvw @ 1:58 pm

Found this picture in an old mail and I thought why not… Lets share ;-)

  • Share/Bookmark

Tags: , , , , , , ,


Mar 04 2010

Using fstab to automatically mount samba drives

Category: Computers, FreeBSDmariusvw @ 10:10 pm

Using fstab to automatically mount samba drives from for example a WD ShareStore drive with CIFS and SMB share support.

My configuration runs on FreeBSD 7.

First put your password information into a special tiny file /etc/nsmb.conf

[SERVER]
addr=192.168.1.5

[SERVER:USER1]
password=PASS1

[SERVER:USER2]
password=PASS2

Next you want to add these to /etc/fstab to auto mount:

# Mount shares
//server@user1/administration /mnt/server/downloads smbfs rw,auto 0 0
//server@user1/communicatie /mnt/server/documents smbfs rw,auto 0 0
//server@user2/creative /mnt/server/music smbfs rw,auto 0 0

I hope this helps you out with easy mounting it :-)

  • Share/Bookmark

Tags: , , , , , , , ,


Mar 03 2010

Easy replace php short open tags with long php open tags.

Category: Developmentmariusvw @ 8:36 pm

I wrote a quite simple script to fix short open tags to long open tags.

This script is compatible with CakePHP 1.1 and 1.2, on request :-)

Have fun using it!

I suggest saving this file to /usr/local/bin/php_fix_short_open_tag

#!/bin/sh
# Written by Marius van Witzenburg

path="."
if [ ! -z "$1" ] && [ -d "$1" ]
then
path="$1"
elif [ ! -z "$1" ]
then
echo "Invalid path defined, using default."
fi

echo "Searching for php short open tags..."
echo "Starting path: $path"
find $path -name '*.php' -type f -exec perl -i -wpe 's/< \?=/<\?php echo /g' '{}' \;
find $path -name '*.php' -type f -exec perl -i -wpe 's/<\?/<\?php/g' '{}' \;
find $path -name '*.php' -type f -exec perl -i -wpe 's/<\?phpphp/<\?php/g' '{}' \;
find $path -name '*.ctp' -type f -exec perl -i -wpe 's/<\?=/<\?php echo /g' '{}' \;
find $path -name '*.ctp' -type f -exec perl -i -wpe 's/<\?/<\?php/g' '{}' \;
find $path -name '*.ctp' -type f -exec perl -i -wpe 's/<\?phpphp/<\?php/g' '{}' \;
find $path -name '*.inc' -type f -exec perl -i -wpe 's/<\?=/<\?php echo /g' '{}' \;
find $path -name '*.inc' -type f -exec perl -i -wpe 's/<\?/<\?php/g' '{}' \;
find $path -name '*.inc' -type f -exec perl -i -wpe 's/<\?phpphp/<\?php/g' '{}' \;
find $path -name '*.thtml' -type f -exec perl -i -wpe 's/<\?=/<\?php echo /g' '{}' \;
find $path -name '*.thtml' -type f -exec perl -i -wpe 's/<\?/<\?php/g' '{}' \;
find $path -name '*.thtml' -type f -exec perl -i -wpe 's/<\?phpphp/<\?php/g' '{}' \;

echo 'Done!'

Please leave the credits in if you want to modify it.
Donations are welcome haha :-P

  • Share/Bookmark

Tags: , , , , , , , ,


Mar 02 2010

Shellproxy, an easy tool to run shell commands from PHP or other languages.

Category: Computers, Development, FreeBSD, Workmariusvw @ 8:53 pm

This is a simple script that runs a shell command from PHP with the function system().
It sometimes happens that a command doesn’t close the stdin or stdout, resulting the system() function to halt and wait for it to finish…
This causes PHP to reach the 30 second time limit and kill the script.

This script runs it in the background and you could make your commands send their output to a log file and still having full control.

Read the code below how to use it.

You can compile it by placing the code into ’shellproxy.c’ and then compile it with the following command:

gcc -o shellproxy shellproxy.c

I hope this is something useful for you as it was for me.


#include
#include
#include

int main(int argc, char *argv[]) {
char command[1024];
int t;

if (argc == 1) {
printf("\nShell Proxy\n");
printf("By Marius van Witzenburg \n\n");
printf("You will mostly use this program from PHP or any other\n");
printf("webscripting language to background run programs\n\n");
printf("Usage:\n");
printf("- CLI:\n");
printf("shellproxy \" \"\n");
printf("shellproxy \" > redirect.txt\"\n");
printf("- PHP:\n");
printf("system('shellproxy \" &\"');\n");
printf("system('shellproxy \" > redirect.txt\"');\n\n");
}

command[0] = 0;

for (t = 1; t < argc; t++) {
strcat(command, argv[t]);
strcat(command, " ");
}

fclose(stdin);
fclose(stdout);
fclose(stderr);

system(command);
}

It would be nice if you keep my name mentioned into this code if you use it.

Ps. Donations are welcome ;-)

  • Share/Bookmark

Tags: , , , , , , ,


Mar 01 2010

project: www.slagboomvld.nl

Category: Workmariusvw @ 2:17 pm

We finished the website of Slagboom Vlaardingen.

Its viewable at http://www.slagboomvld.nl

In the gallery below the left one is the old design and the right side is the new design.

Design & Development by PersC

  • Share/Bookmark

Tags: , , , , , ,


Feb 27 2010

OMNIA Sleeveless Hoody pictures

Category: Clothing, Internet, Musicmariusvw @ 6:08 pm

One of the limited Sleeveless Hoodies from the OMNIA webshop.

Some of you might know the hoody with the sleeves…
They were dropped off while transporting ;-)

  • Share/Bookmark

Tags: , , , , , , , ,


Feb 27 2010

Always fun to get a order with clothes in a fancy box from OMNIA ;-)

Category: Living, Music, Shopsmariusvw @ 2:53 pm

We received our order last week from the OMNIA webshop.

Thanks Chloe and Monique :-D

  • Share/Bookmark

Tags: , , , , , , ,


Feb 19 2010

Some funny movies using camera stop-motion. Which I like a lot :-)

Category: Funnies, Musicmariusvw @ 9:10 pm

T-Shirt War!! (stop-motion music video):

Guitar: Impossible (stop motion music short by MysteryGuitarMan):

I hope you’ll like them too…
I especially like the second movie with the guitar. Since I play guitar my self ;-)

The last one is a impressive movie clip of a lady playing the piano with the song ‘Chop Suey’:

http://www.dumpert.nl/mediabase/836441/ed9a8fce/dumpert_muziek.html

  • Share/Bookmark

Tags: , , , , , , ,


Feb 14 2010

Use a sausage as stylus for your iPhone touch screen. (How sick is that?)

Category: Animals, Nature, iPhonemariusvw @ 11:33 am

In life I noticed that people use the most weird things to ‘invent’ something new…

In the following post and movie you can read and see how people use a sausage instead of their fingers, cause they use gloves the touch screen doesn’t work… This solves that problem… But on the other hand it raises another problem, we have to kill animals to make sausages to use as a stylus for an iPhone gadget? How sick is that…

Read the full article on the link below:

http://www.popsci.com/technology/article/2010-02/meat-iphone-sausage-stylus

Here you can see how they are used as drumsticks…

  • Share/Bookmark

Tags: , , , , , , , , , , ,


Next Page »