MySQL Quick Backup

  • View
  • Edit
  • Delete
Situation: 
this function creates a demoDB.sql file of demoDB Database. The path may change according to your setup.


function dump_db {
/usr/local/mysql/bin/mysqldump -u root -p $1 > $1.sql
}


Browse trhu bash_history

  • View
  • Edit
  • Delete
Situation: 
This script just browses through the .bash_history file. It displays the commands that match the keyword you type as argument.


function browse_history {
cat ~/.bash_history | grep $1
}


Add Hosts entry and apache vhost

  • View
  • Edit
  • Delete
Situation: 
Working with drupal locally might be a little bit annoying with the domain issues it can have. thats why a good option ( working with multiple installations ) is to create different host entries and create a vhost for each entry.


#Register a host in /etc/hosts
function register_host {
echo "127.0.0.1 $1.site" | sudo tee -a /etc/hosts
add_vhost $1 $2 $3 | sudo tee -a /etc/apache2/extra/httpd-vhosts.conf
sudo apachectl restart
}


function add_vhost {
echo "
#$3
<VirtualHost *:80>
ServerName $1.site
DocumentRoot /Users/webalab/$2
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log common"
</VirtualHost>"
}

Usage:


Basic Functionality

  • View
  • Edit
  • Delete
Situation: 
The MacPorts Project is an open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system.

$ sudo port selfupdate : Updates the macport's app list.
$ port list : List All packages
$ port search kwd : Search "kwd" in the packages list
$ port info pkg: Retrieve information about the pkg
$ port deps pkg: Show the dependencies of a pkg
$ port variants pkg : Show pkg variants
$ sudo port instal pkg: Install pkg
$ port clean --all pkg: Clean all the mess done by the app installation whatsoever
$ port uninstall pkg: Uninstal pkg


Change personal data

  • View
  • Edit
  • Delete
Situation: 
When using irssi (command line irc client) by default it grabs all your personal data and displays it in the server.

From The irssi Startup HOWTO

Type those commands to change the default user settings. ( I'm saving some time not explaining each one since they are pretty obvious )

  • /SET nick [Your nick name]
  • /SET alternate_nick [Your alternate nick]
  • /SET user_name [Your username] if you have ident enabled this doesn't affect anything
  • /SET real_name [Your real name]

Empty trash without questions asked

  • View
  • Edit
  • Delete
Situation: 
Deleting your trash is a fairly easy task, however there are some files that are a little bit painful to deal with while emptying your trash. Can be something related to permissions or just a billion of annoying "are you sure" questions.

Right-click the trash icon and hold down alt/opt key while clicking "Empty Trash". This will empty the trash no matter whats inside and without prompting annoying dialogs whatsoever.


BrowserSniffer

  • View
  • Edit
  • Delete

One of the biggest craps in the world ( real and internet ) is something called IE 6 ( internet explorer 6 ). Nothing works as expected on that piece of crap. That's why I've decided to contribute to the world helping innocent souls that are using IE6 to change to a real browser or at least upgrade to IE7.

This little drupal module detects the user's browser and redirect to a specified path. At the beginning the idea was just to point ie6 requests to a specific path, but while developing I thought that this could get actually useful.


QDGallery

  • View
  • Edit
  • Delete

Click to Launch

From time to time i need to put a set of images up on the internet. That's quite an easy task, however, im more lazy than that. I know there are a ton of sites and apps to publish pictures but all of those are a pain in the ass if you don't care that much about the pictures. They ask so many stuff just to upload one picture, title, description, etc... and the worst part is that you pretty much need to upload 1 pic at a time, generally thru a web interface.


3D Pong

  • View
  • Edit
  • Delete

Click to Launch

Little demo using 3D flash libraries, its just a proof of concept. Maybe ill make this gameable, i just need some time.


Fine tune the volume

  • View
  • Edit
  • Delete
Situation: 
Changing up or down the volume with the keyboard shortcut will change the volume one whole block

Adjusting volume while pressing shift: Silent mode
Adjusting volume while pressing shift and option: Fine-tune volume ( instead of increasing/decreasing block by block )


SSH Access without password

  • View
  • Edit
  • Delete
Situation: 
If you have a jailbroken iphone you may know ( if you are geek enough ) that you can connect to the phone through ssh. That means that you can control your phone wirelessly from your computer. However, you need to type your password every time you connect to the phone (as with any other ssh connection), this is perfectly normal, but it will be better if you just can do it without having to type your password every time.

The way to do this is with 'ssh authentication keys'.

You can find the instructions here:
http://www.extrapepperoni.com/2007/09/23/openssh-on-the-iphone/

Im posting the same instructions without so many letters, if you are new to all this, I strongly recommend that you read the extrapepperoni.com instructions.

so this is what you need to type in your mac (or linux):

# ssh-keygen -t rsa

That creates 2 files (id_rsa and id_rsa.pub) , to be sure it worked type the following command:

# ls ~/.ssh/


E-mail contact form

  • View
  • Edit
  • Delete
Situation: 
This is a really old script, but people keep asking me about how to do it, so this time i build a little bundle including all the assets needed to create a Contact Form with flash (as2). It takes a few arguments from the flash movie ( name, mail and comment, although you can add as many as you want ) and uses the .txt file as a template for the mail body.

The .zip file include a .fla, a .php and a .txt file

You should open all files and change the settings first, then upload the .txt and the .php to the server.

You might want to add a little bit of security in order to block spam.


Powered by Drupal, an open source content management system