Monthly Archives: October 2010

How to ZIP files with PHP

Most web servers these days run on a LAMP configuration (Linux, Apache, MySQL, PHP). Because the Operating System is Linux, the default archival and compression utilities are TAR and GZIP resulting in files like “filename.tar.gz”. There is nothing wrong with these utilities, however, if you are providing a visitor to your web site with a dynamic download of archived files you would probably want to provide the files in the very well known compressed format (typically used on Windows OS computers).

Using Perl to time Bash Calls – Bash fine grain timer

Using Perl to time Bash Calls – Bash fine grain timer

I was looking for a way to cross platform way to make a microsecond timer or anything less than one second for that matter in bash. Aside from doing a fork each time this function needs to be called, this is a pretty good alternative to c programming because it is quick and dirty. This function will allow us to be portable and not think too much about the implementation for the time being.

#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes qw(usleep nanosleep);
usleep(100);

Bash Multi Get using wget

Bash Multi-Get using wget

If you were ever looking at using wget with a proxy – then this is probably the script for you. I haven&squo;t spent much time testing this and it requires a helper program written in perl to get the timer resolution to handle properly. The idea behind this script is to be able to traverse a list of proxies so that you can test accessing your site from a bunch of “different places at once”.
Continue reading

Bash SQL Query Helper

What is Bash SQL Query Helper?

This script is a very simple script that helps one to run sql commands from the command line with the command name and the query as opposed to running all sorts of switches. This is definately not a complicated script and there are probably some security considerations around using such a script with certain fields saved in it. But the main goal is to be able to call the mysql client to give me a result set as simple as possible.

Continue reading

Restoring MySQL Dump with PHP

As web developers, we are usually tasked with deploying a project to a production server that we don&squo;t always have access to. And in most cases the projects require a database. The usual plan of action consists of running a database dump, copying the sql sump file over to the production server, and restoring the dump file using the MySQL CLI. However, in cases where we have limited access to the production server including no shell access, results in the problem: How do we install the database.

Remote DB Access

Having trouble accessing your database remotely?

Hosting providers are among the funniest people to deal with, and I am not talking about a humerous evening I had out with a server admin one time at the bar. They are a strange breed of people much like any other class you can name outsideof “THEM”, and they are this way for a specific reason.
Continue reading

What is remv.php

What is remv.php

The file remv.php is a script that MAY be found inside your website regardless if you have a CMS or not and is a popular script used to inject code into your site. This is definately not a core file and is not the original file name of the script if found in your site.

Continue reading

Simple Perl Template Engine

Simple Perl Template Engine

 

There are many uses for a template engine, but the basic idea to my knowledge is to reuse a design and replace the content quickly and efficiently. Like code re-usage, this helps to make our lives easier by allowing us to save time and preventing us from having to duplicate manually and create a page for every link. This also allows us to grab data from a data store, or database that will make managing content somewhat easier.

Bash Sqlite Ssh Connection Manager

Bash Sqlite Ssh Connection Manager

Looking for a quick and dirty way to manage a bunch of connections to ssh hosts using a simple bash script. I figured that it would be simple enough to create a single table sqlite database. There is no password storage in this version of the database as I am using it simply as a connection manager.

Bash Connect Ssh

Continue reading