21 Jan 2009 @ 9:27 PM 

I created this class to facilitate some routine tasks when modding or hooking software. If you dont know what hooking is or how to use .dll’s it is of no use to your. It also bridges the gap between oop and asm a little, I try to give you the best of asm in a oop format.

Features

  • Console – debugging console similar to cmd, it provides a easy i/o for target application data or information you need from your .dll
  • jmpPatch – most people know what a jmp patch is, this has your generic one
  • stripJmpPatch – this will place a jmpPatch to functions that are members of a class, they dont have to be naked.
  • keyhook – you can easily hook the window class or you can use getasynckeystate. You just pass it your function.
  • other stuff – message boxes and such

In a Nutshell

This class does all the work for you, just create the project and pass a function into the constructor and it will take care of the threading. The function you pass to it is the main function of the thread that is started, in this function you can handle key input or whatever manipulations you wish.

How to use

This is for use with Visual Studio, as I use masm syntax in the inline asm. Basically you make a VS c++ project of “.dll” type, then you include modtoolz.h class. If you dont know how to do that, just stop now. If you want a in depth “noob” tutorial, I wrote one here.

add these to your stdafx.h

#include <stdio.h>
#include <iostream>
#include <io.h>
#include <stdio.h>
#include <fstream>
using namespace std;

Everything happens when you call the constructor (as it should with oop). So in your main.cpp you could call the constructor like this

#include ModTools.h
// other stuff
// modtools constructor one
ModTools mt("window name", &myEngine);

If you did it like that you would have to have a function “myFunction” that you could handle events and keys. The function you pass into it with this constructor gets started in the thread, so when that function terminates, so does the thread. You need a while loop and some stuff like so

1
2
3
4
5
6
7
8
9
10
long WINAPI myEngine(long lparam)
{
while(1){																		// this goes forever, so your thread stays alive
Sleep(10);																// ~10 millisecond delay so it dont lag
// if they hit f12 turn on the console
if(GetAsyncKeyState(VK_F12) == -32767)
{
mt.Console();
}
}// end the while loop

that function would toggle the console on/off with the press of F12. Of course you could make it do any action based on any keys, for instance call a function inside the program, or change a memory value inside the program. Since you are inside the program in your .dll you can change anything or call the programs functions.

The above method is easy and does work fine; however, there is another constructor that you can also use which is more efficent. The second constructor (that you can use) hooks directly into the window, this allows you to handle key input better.

You can use the second constructor like so

1
2
3
#include ModTools.h
// second constructor
ModTools mt("brood war", &amp;KeyHandler);

In this case you can only pass it a keyhandler, anything that takes time to process that is in this “keyhandler” function will lag the target application instantly. If you wish to do heavy processing and queues and such either make a new thread or jmpPatch to another function in your code.

Anyway this is what a keyhandler function looks like

1
2
3
4
5
6
7
8
9
bool KeyHandler(int keyCode)
{
// Is key ~ pressed?
if (keyCode == VK_OEM_3)
{
// DO SOMETHING
}
return FALSE;
}

This second constructor is more advanced and I do not recommend you use it unless you know what you are doing. That said, the second constructor is the way to go if you want to make really good applications.

If you are still confused I made a tutorial on another site that is pretty informational. You can acess that here. In that tut I show how to use the modtools.h class to do stuff with the game starcraft.

You can download modtools.h here modtools-v02

Posted By: admin
Last Edit: 21 Jan 2009 @ 09:27 PM

EmailPermalinkComments (0)
Tags
 21 Jan 2009 @ 9:27 PM 

I created this class to facilitate some routine tasks when modding or hooking software. If you dont know what hooking is or how to use .dll’s it is of no use to your. It also bridges the gap between oop and asm a little, I try to give you the best of asm in a oop format.

Features

  • Console – debugging console similar to cmd, it provides a easy i/o for target application data or information you need from your .dll
  • jmpPatch – most people know what a jmp patch is, this has your generic one
  • stripJmpPatch – this will place a jmpPatch to functions that are members of a class, they dont have to be naked.
  • keyhook – you can easily hook the window class or you can use getasynckeystate. You just pass it your function.
  • other stuff – message boxes and such

In a Nutshell

This class does all the work for you, just create the project and pass a function into the constructor and it will take care of the threading. The function you pass to it is the main function of the thread that is started, in this function you can handle key input or whatever manipulations you wish.

How to use

This is for use with Visual Studio, as I use masm syntax in the inline asm. Basically you make a VS c++ project of “.dll” type, then you include modtoolz.h class. If you dont know how to do that, just stop now. If you want a in depth “noob” tutorial, I wrote one here.

add these to your stdafx.h

#include <stdio.h>
#include <iostream>
#include <io.h>
#include <stdio.h>
#include <fstream>
using namespace std;

Everything happens when you call the constructor (as it should with oop). So in your main.cpp you could call the constructor like this

#include ModTools.h
// other stuff
// modtools constructor one
ModTools mt("window name", &myEngine);

If you did it like that you would have to have a function “myFunction” that you could handle events and keys. The function you pass into it with this constructor gets started in the thread, so when that function terminates, so does the thread. You need a while loop and some stuff like so

1
2
3
4
5
6
7
8
9
10
long WINAPI myEngine(long lparam)
{
while(1){																		// this goes forever, so your thread stays alive
Sleep(10);																// ~10 millisecond delay so it dont lag
// if they hit f12 turn on the console
if(GetAsyncKeyState(VK_F12) == -32767)
{
mt.Console();
}
}// end the while loop

that function would toggle the console on/off with the press of F12. Of course you could make it do any action based on any keys, for instance call a function inside the program, or change a memory value inside the program. Since you are inside the program in your .dll you can change anything or call the programs functions.

The above method is easy and does work fine; however, there is another constructor that you can also use which is more efficent. The second constructor (that you can use) hooks directly into the window, this allows you to handle key input better.

You can use the second constructor like so

1
2
3
#include ModTools.h
// second constructor
ModTools mt("brood war", &amp;KeyHandler);

In this case you can only pass it a keyhandler, anything that takes time to process that is in this “keyhandler” function will lag the target application instantly. If you wish to do heavy processing and queues and such either make a new thread or jmpPatch to another function in your code.

Anyway this is what a keyhandler function looks like

1
2
3
4
5
6
7
8
9
bool KeyHandler(int keyCode)
{
// Is key ~ pressed?
if (keyCode == VK_OEM_3)
{
// DO SOMETHING
}
return FALSE;
}

This second constructor is more advanced and I do not recommend you use it unless you know what you are doing. That said, the second constructor is the way to go if you want to make really good applications.

If you are still confused I made a tutorial on another site that is pretty informational. You can acess that here. In that tut I show how to use the modtools.h class to do stuff with the game starcraft.

You can download modtools.h here modtools-v02

Posted By: Michael
Last Edit: 21 Jan 2009 @ 09:27 PM

EmailPermalinkComments (0)
Tags
 21 Jan 2009 @ 12:55 PM 
MSI GPS Reciver

MSI GPS Receiver

I dont have built in gps in my HTC 8525, so I ordered this to connect with my phone. On ebay it cost me about $50 with shipping.

It has proven to be very versatile. It connects to the satellites quickly and works in the car. I have had it in places where my cell does not even work and it works, granted not in 3d but it worked in 2d.

About the mini usb port

Unless you have a bluetooth on your computer there is no connectivity.  The mini usb port is for charging, but it also transmits the GPS information through uart via the usb port. So if you want to connect this GPS module to a microchip it works great.

Pins one and four are power and ground respectively. Pins 2 and 3 are rx and tx @ uart levels. It transmits at 38,400 baud on the mini usb , which is much faster than the 4,800 baud via bluetooth.

I for one would rather have it this way, I can just get a $5 bluetooth for the computer if i want to communicate via bluetooth. This uart communication hidden in the mini usb allows for much more versatility and customization.You can connect it to a MCU, or you can connect it to a MAX232 converter and then to the serial port. I should also add it is easy to develop your own applications to process the gps data.

NMEA

The protocol that GPS devices use is called NMEA, it looks like this
$GPGGA,023530.379,2917.1882,N,09448.0603,W,0,00,,47.5,M,-23.9,M,,0000*72
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,3,1,10,14,54,009,,31,65,209,,22,57,100,,30,28,092,*7C
$GPGSV,3,2,10,18,24,117,24,05,20,065,,11,14,305,,12,12,055,*70
$GPGSV,3,3,10,32,12,312,,19,00,254,*71
$GPRMC,023530.379,V,2917.1882,N,09448.0603,W,,,190109,,,N*64

This information tells you all about your location, the time, your speed and the satellites you have connected to. I’m not going to explain it all here, but here is a pdf explaining NMEA. nmea0183

Conclustion

While this device was a little pricey, it proved to be a great addition to my electronics. It works great with programs like IGO to make sure I never get lost.

Posted By: Michael
Last Edit: 21 Jan 2009 @ 12:55 PM

EmailPermalinkComments (2)
Tags
Categories: Electronic Products
 13 Jan 2009 @ 6:03 PM 

Ok i know your saying to yourself “theres already tons of these” but i looked at them and they are long. Anyway i made this to test my ports. Very simple a led connected to port “B” and port “D” on a 877. I know there are better ways to make a led chaser using less pins but im testing my ports (new board) so i need to have a light on each pin to see if it works correctly, im making like a prototyping board and i want to know that all the connections/pins are solid before i make anything out of it.

The best part about this is “bit shifting”, no case/switches or any of that crap. This is the while loop just put it in your main and modify it for your application. It speeds up and slows down, thats what the delay increment is for. before you get into the while loop. If for some reason your using a port that has more than 8 pins you wont be able to store the “bit” variable in a int, try like a int16 etc.


int i =0;
int bit = 0;
int delay = 0;
while(1)
   {

      if (delay > 50){delay = 0;} // if the delay is getting big make it small again so it goes fast
      bit = 1; // set the bit to the rightmost position (pin 1)
      for(i=0;i<8;i++)
      {
         output_d(bit << i); // shift bit to the left "i" times
         output_b(bit << i);
         delay_ms(delay);
      }
      bit = 0b10000000; // put the bit on the far left (pin 8)       for(i=0;i<8;i++)
      {
         output_d(bit >> i); // shift the bit to the right "i" times
         output_b(bit >> i);
         delay_ms(delay);
      }
      delay++; // increment the delay so it goes slower

   }
Posted By: Michael
Last Edit: 13 Jan 2009 @ 06:03 PM

EmailPermalinkComments (3)
Tags
Categories: Uncategorized
 13 Jan 2009 @ 5:51 PM 

There were requests for a picture … this was all i could find, it gives you a idea how the display might have been hooked up

3 digit 7 seg display

3 digit 7 seg display

This was for our intro to engineering project It is a thermometer with a lm34 connected to ra0. It multiplexed 3 “7Segment” led displays connected to the ports, i think the digit was port E and the 7 led’s of the “7Segment” displays were connected to B. You can easily use it on a 877a also if you include the .h for the 877a . I will try and post the schematic but it was all pretty much done on the fly, a schematic was only made for half of it.
It has a lot of functions to do stupid stuff, you dont need them. Any questions post a reply. I would not use this code because i doubt you will have the same setup but it would be a great reference.

/******************************************************************************
/ Program for a pic 16F877 to take analoge input from RA0 in the range
/ of 0- ? volts and display it to a three digit 7 segment Led display. The
/ display is multiplexed and the common cathode/anode is controlled by
/ port E and the actual hex of the number is sent through port B
/
/ by, Michael
/ 10-3-07
/ www.zonemikel.com
/*****************************************************************************/

#include "877.h"
#include <stdio.h>
#include <stdlib.h>

// declare functions
void findnumbers(float temp, int choice);
void sendhex(int number, int digit);
void displaynumbers(int hundreds, int tens, int ones);
int getavgtemp();
void demo(int k);
void showled(float temp, int choice);
void blink();

void main()
{
int i = 0;
int choice = 0; // current menu choice
int16 adc_value; // adc read from AN0 0-1023
float volts; // volts 0-5v
float total = 0; // total for average
float temp = 0; // chop off the .xx
float tempC = 0; // temp in celcius
int scroll[19] = {16,16,16,5,15,14,12,17,16,14,1,11,16,1,0,0,0,0,16};
int k =0;
int n=0;

// tell them what i am
for(k=0;k<20;k++)
{
if (!input(PIN_C1) || !input(PIN_C1)) // did they hit a button ?
{break;} // if so get out of here !
for(i=0; i<200; i++){
for(n=0; n<5; n++)
{
sendhex(scroll[k],1);
sendhex(scroll[(k-1)],2);
sendhex(scroll[(k-2)],3);
}// end for n
}// end for i
}

setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_DIV_8);
set_adc_channel(0);

while(1)
{

if (!input(PIN_C1))
{
choice++;
while(!input(PIN_C1)) // let us see we are piking cX menu choice
{displaynumbers(11, 0, choice);}
output_e (0x00); // turn off digit of 7 seg display if not it continues
// to display the last digit of whatever u had b4
}
if (!input(PIN_C3))
{
choice--;
while(!input(PIN_C3)) // let us see we are piking cX menu choice
{displaynumbers(11, 0, choice);}
output_e (0x00); // turn off digit of 7 seg display if not it continues
// to display the last digit of whatever u had b4
}

switch(choice)
{
case 0:
// get the average and store it in var temp in F
total = 0;
for (i=0; i<20; i++)
{

findnumbers(temp, choice);
adc_value = read_adc();
volts = (float)(adc_value * 4.8)/1023.0;
//delay_us(100);
total += volts;
}

temp = ((total/20)*100);
showled(temp,choice); // turn on color led for hot/med/cold/freezing
// display temp on 3 digit 7seg led, turn on light to do with temp
for (i=0; i<50; i++)
{if (!input(PIN_C1) || !input(PIN_C3))
{break;}
findnumbers(temp, choice);}

break;

case 1:
// get the average and store it in var temp in C
total = 0;
for (i=0; i<20; i++)
{
findnumbers(tempC,choice);
adc_value = read_adc();
volts = (float)(adc_value * 4.8)/1023.0;
//delay_us(100);
total += volts;
}

tempC = ((((total/20)*100)-32)/1.8);
// display temp on 3 digit 7seg led, turn on light to do with temp
showled(tempC,choice); // turn on color led for hot/med/cold/freezing
// display temp on 3 digit 7seg led, turn on light to do with temp
for (i=0; i<50; i++)
{if (!input(PIN_C1) || !input(PIN_C3))
{break;}
findnumbers(tempC, choice);}
break;

case 2:
// send information to serial (uart) for commuication with other device
for (i=0; i<3; i++)
{
if (!input(PIN_C1) || !input(PIN_C1)) // did they hit a button ?
{break;} // if so get out of here !
if (i == 2){output_high(PIN_E0);}
if (i == 1){output_high(PIN_E1);}
if (i == 0){output_high(PIN_E2);}
delay_ms(100);
output_b (0b1000000);
delay_ms(100);
output_b (0b0100000);
delay_ms(100);
output_b (0b0010000);
delay_ms(100);
output_b (0b0001000);
delay_ms(100);
output_b (0b0000100);
delay_ms(100);
output_b (0b0000010);
delay_ms(100);
output_b (0b0000001);
delay_ms(100);
}
total = 0;
for (i=0; i<20; i++)
{
adc_value = read_adc();
volts = (float)(adc_value * 4.8)/1023.0;
//delay_us(100);
total += volts;
}

temp = ((total/20)*100);
delay_ms(200);
printf("\f ADC0: %f temp: %f total: %f i: %i", volts, temp, total, i);
delay_ms(200);
break;

case 3:
// a colorful placeholder thing, flashes lights and counts
demo(5);
break;

case 4:
// something to display on the seven seg display
// super pic 1000 is displayed

for(k=0;k<20;k++)
{
if (!input(PIN_C1) || !input(PIN_C1)) // did they hit a button ?
{break;} // if so get out of here !
for(i=0; i<100; i++){
for(n=0; n<5; n++)
{
sendhex(scroll[k],1);
sendhex(scroll[(k-1)],2);
sendhex(scroll[(k-2)],3);
}// end for n
}// end for i
}// end for k

break;

case 5:
blink();
break;

default: // out of bounds set to 0 (zero) again
choice = 0;
break;
}
}// end of while(1)
}// end of main

// blinks led of temp range
void showled(float temp, int choice)
{
if (choice == 1){temp = (((temp*9)/5)+32);}
output_d (0x00); // all off

if (temp > 0 && temp < 50)
{
output_high(PIN_D0);
}
if (temp > 50 && temp < 70)
{
output_high(PIN_D1);
}
if (temp > 70 && temp < 90)
{
output_high(PIN_D2);
}
if (temp > 90)
{
output_high(PIN_D3);
}
}
// function to find number
void findnumbers(float temp, int choice) // get hundreds tens ones (for seven seg display)
{

int inttemp = 0; // temp with decimal removed
int hundreds = 0; // hundreds position
int tens = 0; // tens position
int ones = 0; // ones position
int ForC; // f or c temp
if (choice == 0){ForC = 13;}
if (choice == 1){ForC = 11;}
if (choice == 3){ForC = 16;} // dont do this print nothing
if (temp < 100)
{
inttemp = temp;

hundreds = (inttemp/100)%(10);
tens = (inttemp/10)%(10);
ones = (inttemp%10);
displaynumbers(tens, ones, ForC);
}

if (temp > 100)
{
inttemp = temp;

hundreds = (inttemp/100)%(10);
tens = (inttemp/10)%(10);
ones = (inttemp%10);
displaynumbers(hundreds, tens, ones);
}
if (temp > 255)
{
displaynumbers(12, 0, 1);
}

}

// this converts a number to the desired high/low combination
// for the 7 seg led display
void sendhex(int number, int digit)
{
//dot 	g 	f 	e 	d 	c 	b 	a
// 0 	0 	0 	1 	1 	1 	1 	1 	1 	3F
output_e (0x00);
// send hex to port b to make number
if (number == 0){output_b (0x3F);} // output 0 to port b 11000000
if (number == 1){output_b (0x6);} // 1 11111001
if (number == 2){output_b (0x5B);} // 2 10100100
if (number == 3){output_b (0x4F);} // 3
if (number == 4){output_b (0x66);}
if (number == 5){output_b (0x6D);}
if (number == 6){output_b (0x7D);}
if (number == 7){output_b (0x07);}
if (number == 8){output_b (0x7F);}
if (number == 9){output_b (0x67);}
// all these need to be fixed for common cathode
if (number == 10){output_b (0x88);} // A
if (number == 11){output_b (0x39);} // C // cathode 11000110 00111001
if (number == 12){output_b (0xF9);} // E // for cathode   11111001
if (number == 13){output_b (0x71);} // F // 10001110 01110001
if (number == 14){output_b (0x73);} // P // 10001100 01110011
if (number == 15){output_b (0x3E);} // U // 01111110 00111110
if (number == 16){output_b (0x0);} // nothing at all
if (number == 17){output_b (0x50);} // lower case r  01010000

//turn on the digit(send high to common cathode via transistor)
if (digit == 3){output_high(PIN_E0);}
if (digit == 2){output_high(PIN_E1);}
if (digit == 1){output_high(PIN_E2);}
delay_us(100);

}

// this just sends the right number to the right digit if its less than
// 100 it will use the extra digit to display a F eg. 45F
void displaynumbers(int hundreds, int tens, int ones)// send to led
{
int i = 0;

// if its more than 100 display eg. 102 else display eg. 67F
if(hundreds >= 0) // always do this loop when u dont want F
{
for(i=0; i<200; i++)
{
sendhex(hundreds, 3);
sendhex(tens, 2);
sendhex(ones, 1);
}
}else{
for(i=0; i<200; i++)
{
sendhex(tens, 3);
sendhex(ones, 2);
sendhex(12, 1); // 12 is F
}
}
}
void demo(int k) // do neat stuff
{
int i = 0;

for (i = 0; i < 255; i++)
{
if (!input(PIN_C1) || !input(PIN_C3)) // did they hit a button ?
{break;}
output_high(PIN_D0);
delay_ms((k*i)/200);
output_low(PIN_D0);
//findnumbers(k); // k is normally unchanging.
output_high(PIN_D1);
findnumbers(i,3);
delay_ms((k*i)/100);
output_low(PIN_D1);
//
output_high(PIN_D2);
//findnumbers(i);
delay_ms((k*i)/200);
output_low(PIN_D2);
//
output_high(PIN_D3);
//findnumbers(i);
delay_ms((k*i)/100);
output_low(PIN_D3);

delay_ms((k*i)/100);
// reverse

output_high(PIN_D3);
//findnumbers(i);
delay_ms((k*i)/200);
output_low(PIN_D3);
//
output_high(PIN_D2);
//findnumbers(i);
delay_ms((k*i)/100);
output_low(PIN_D2);
//
output_high(PIN_D1);
//findnumbers(i);
delay_ms((k*i)/200);
output_low(PIN_D1);
//
output_high(PIN_D0);
//findnumbers(i);
delay_ms((k*i)/100);
output_low(PIN_D0);
}
}

void blink()
{
int i = 0;
while(1)
{
if (!input(PIN_C1)) // get out if they hit button one
{break;}

if (!input(PIN_C3)) // if they hit button two incrament i
{i++;}
findnumbers(i,3);
// lights high
output_high(PIN_D3);
output_high(PIN_D2);
output_high(PIN_D1);
output_high(PIN_D0);
delay_ms(i);
output_low(PIN_D2);
output_low(PIN_D1);
output_low(PIN_D0);
output_low(PIN_D3);
delay_ms(i);

}
}

/* table so i dont have to calculate again !!!
For common Cathode :

Hex Number

Seven Segment conversion

Seven Segment equivalent
dot 	g 	f 	e 	d 	c 	b 	a
0 	0 	0 	1 	1 	1 	1 	1 	1 	3F
1 	0 	0 	0 	0 	0 	1 	1 	0 	06
2 	0 	1 	0 	1 	1 	0 	1 	1 	5B
3 	0 	1 	0 	0 	1 	1 	1 	1 	4F
4 	0 	1 	1 	0 	0 	1 	1 	0 	66
5 	0 	1 	1 	0 	1 	1 	0 	1 	6D
6 	0 	1 	1 	1 	1 	1 	0 	1 	7D
7 	0 	0 	0 	0 	0 	1 	1 	1 	07
8 	0 	1 	1 	1 	1 	1 	1 	1 	7F
9 	0 	1 	1 	0 	0 	1 	1 	1 	67

For common Anode :

Hex Number

Seven Segment conversion

Seven Segment equivalent
dot 	g 	f 	e 	d 	c 	b 	a
0 	1 	1 	0 	0 	0 	0 	0 	0 	C0
1 	1 	1 	1 	1 	1 	0 	0 	1 	F9
2 	1 	0 	1 	0 	0 	1 	0 	0 	A4
3 	1 	0 	1 	1 	0 	0 	0 	0 	B0
4 	1 	0 	0 	1 	1 	0 	0 	1 	99
5 	1 	0 	0 	1 	0 	0 	1 	0 	92
6 	1 	0 	0 	0 	0 	0 	1 	0 	82
7 	1 	1 	1 	1 	1 	0 	0 	0 	F8
8 	1 	0 	0 	0 	0 	0 	0 	0 	80
9 	1 	0 	0 	1 	1 	0 	0 	0 	98
*/
Posted By: Michael
Last Edit: 07 Nov 2009 @ 10:07 PM

EmailPermalinkComments (8)
Tags
Categories: Uncategorized
 13 Jan 2009 @ 5:47 PM 

If for some reason this sends you files that you don’t know what they are rename them to .zip then open them.

This script will backup your mysql dbases except the ones you specify then email them to you, at several emails if you desire. I added the email part, yes the ugly part.

#!/bin/bash
# Shell script to backup MySql database
# To backup Nysql databases file to /backup dir and later pick up by your
# script. You can skip few databases from backup too.
# For more info please see (Installation info):
# http://www.cyberciti.biz/nixcraft/vivek/blogger/2005/01/mysql-backup-script.html
# Last updated: Aug - 2005
# --------------------------------------------------------------------
# This is a free shell script under GNU GPL version 2.0 or above
# Copyright (C) 2004, 2005 nixCraft project
# Feedback/comment/suggestions : http://cyberciti.biz/fb/
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------

MyUSER="username"     # USERNAME
MyPASS="password"       # PASSWORD
MyHOST="localhost"          # Hostname

# Linux bin paths, change this if it can't be autodetected via which command
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
CHOWN="$(which chown)"
CHMOD="$(which chmod)"
GZIP="$(which gzip)"

# Backup Dest directory, change this if you have someother location
DEST="/mnt/backups"

# Main directory where backup will be stored
MBD="$DEST/mysql"

# Get hostname
HOST="$(hostname)"

# Get data in dd-mm-yyyy format
NOW="$(date +"%d-%m-%Y")"

# File to store current backup file
FILE=""
# Store list of databases
DBS=""

# DO NOT BACKUP these databases
IGGY="test smfGCR zonemikel converting forum forums javaprogram mysql phpbb3"

[ ! -d $MBD ] && mkdir -p $MBD || :

# Only root can access it!
# $CHOWN 0.0 -R $DEST
# $CHMOD 0600 $DEST

# Get all database list first
DBS="$($MYSQL -u $MyUSER -h $MyHOST -p$MyPASS -Bse 'show databases')"

for db in $DBS
do
skipdb=-1
if [ "$IGGY" != "" ];
then
for i in $IGGY
do
[ "$db" == "$i" ] && skipdb=1 || :
done
fi

if [ "$skipdb" == "-1" ] ; then
FILE="$MBD/$db.$HOST.$NOW.gz"
# do all inone job in pipe,
# connect to mysql using mysqldump for select mysql database
# and pipe it out to gz file in backup dir :)
$MYSQLDUMP -u $MyUSER -h $MyHOST -p$MyPASS $db | $GZIP -9 > $FILE
sleep 10
mail -s "Backup: $db $(date +"%d-%m-%Y")" zonetejasmikel@yahoo.com < $FILE
echo "EOF"
echo $db
sleep 10
mail -s "Backup: $db $(date +"%d-%m-%Y")" zonemikel@gmail.com < $FILE
echo "EOF"
#mutt -s "Backup: $db $(date +"%d-%m-%Y")" -a $FILE zonetejasmikel@yahoo.com < /dev/null
fi
done
Posted By: Michael
Last Edit: 13 Jan 2009 @ 05:47 PM

EmailPermalinkComments (0)
Tags
Categories: Linux
 13 Jan 2009 @ 5:46 PM 

My first attempt at reproducing a rts in flash. There is a lot to it, you have to calculate the speed and angle of everything. In this one I replaced the cursor, but you can see the probes dont look quite right.

Posted By: Michael
Last Edit: 13 Jan 2009 @ 05:46 PM

EmailPermalinkComments (0)
Tags
Categories: Flash
 13 Jan 2009 @ 5:44 PM 

Made this a while back, its not very efficient but it looks neat

Posted By: Michael
Last Edit: 13 Jan 2009 @ 05:44 PM

EmailPermalinkComments (0)
Tags
Categories: Flash
 13 Jan 2009 @ 5:39 PM 

made this for testing my web server that is on 24/7, turns out it only cost me about $10 max to run it all month.

Posted By: Michael
Last Edit: 13 Jan 2009 @ 05:39 PM

EmailPermalinkComments (2)
Tags
Categories: Flash
 13 Jan 2009 @ 5:35 PM 
this will change the color of the tablecloth or the chaircover. It would be useful for a page where users buy stuff of different colors.
&amp;lt;a href=”http://www.zonemikel.com/Flash/ana.swf” target=”_blank” class=”new_win”&amp;gt;http://www.zonemikel.com/Flash/ana.swf&amp;lt;/a&amp;gt;
Posted By: Michael
Last Edit: 13 Jan 2009 @ 05:35 PM

EmailPermalinkComments (0)
Tags
Categories: Flash
Change Theme...
  • Users » 5
  • Posts/Pages » 71
  • Comments » 62
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Contact Me



    No Child Pages.

Front



    No Child Pages.