autohotkey multiple line string

t_str = 
(
a test
another 
test
)
msgbox % t_str
Share

PHP: create random password

$str = "0123456789abcdefghijklmnopqrstuvwxyz"; 
	$n = 8;
	$len = strlen($str)-1;
	for($i=0 ; $i<$n; $i++){
    	$s .=  $str[rand(0,$len)];  
	}
Share

The easiest way to build your own VPN server

Some people suggest that maybe you should try to build your own vpn server yourself! Indeed it’s not rocket science but still it needs someone to show you the rope. I am not going to be very detailed in each step but you can research them separately.

Step one: First get a VPS

get a Linux VPS. A VPS is shortened for Virtual Private Server. It’s not a whole machine (too costly!) but one portion of a machine. A 256 Ram VPS is about 60-90 USD a year and that’s all you have to pay. And if you manage to sell your VPN accounts, you can even make profits!

Recommended provider: http://www.enzu.com/account/aff.php?aff=184

You need to get a VPS with linux Centos (other systems will work but I only know centOS) installed. After purchasing you will get an IP for your VPS, and a SSH (never mind those terms. Nobody knows what they are) account.

One thing to remember though. You VPS has to be using Xen (again never mind these terms. Just look for Xen VPS) not openVZ. openVZ is a lot cheaper but it won’t work.

Step two: install PPTP server application on your VPS

Use Putty (software name) to log on to your remote VPS using the IP and SSH account provided. And you get a DOS like black Window with a command line like this:

Type at the command line:

wget https://breakwall.net/promo/pptpd.sh

And press enter
Then type at the command line:

bash pptpd.sh 

to run the script.

PPTP server application will be installed on your VPS. At the end of the installation, the script will create an VPN account for you (a username and a password).

That’s it. You now get your own VPN account on your own server! Now you can use the username and password and the IP of your server to log on. Of course you will need to do a simple set up on your Windows or iPad or Android phone like with a VPN account you get from a VPN service provider.

Step three: sell your VPN accounts!

I am just kidding. It takes a lot more to run a VPN business. But soon you will want to impress your friends by creating an VPN account on your server for them too!

It’s easy to add VPN accounts. Just edit a file “/etc/ppp/chap-secrets” on your folder. Wait.. how do you do that? You easiest way for people who are unfamiliar with linux is perhaps using FTP!

1. Download and install FileZilla (FTP client software).
2. Click “site manager” (the first button on the tool bar) and click add site
For Host field: type your server IP.
For Protocol: choose SFTP
For Login type: choose General
Then input your SSH account (not your VPN account!,the one that you VPS provider gives you) . The user name is usually “root”.
3. Click “Connect” and then you open your sever.
Go to /etc/ppp/ and then download the file “chap-secrets”. Edit that file with notepad and add a line:

newaccountname pptpd password *

4. Save the file and upload to the server to replace the old file.

Last but not least, you need to use you SSH account to log on your server command line using Putty again (like in step two) and then type:

service pptpd restart

For your new account to take effect.

Share

Install OpenVPN clients on Windows Mobile (WM) (really works!)

Notice: if you are looking for openVPN solution for Windows mobile (pocket PC), you should definitely check out Breakwall VPN. With it you don’t need to edit the config files any more. it has a openVPN config file generator for Windows Mobile! Breakwall VPN is probably the only WM-friendly VPN service provider.

I tried lots of time to find an OpenVPN client for my Windows Mobile phone and this one really works.
1. Download and unzip this file and then transfer the files to your phone:
http://dallascao.com/cn/wp-content/uploads/2012/02/openvpn.zip
2. Install the software in the following order:
a) ovpnppc.en.ARM.cab b)DaGong OpenVPN_Patch.cab c)Hosts.reg
3 Confirm the installation folder of OpenVPN. Mine is My Storage\Program Files\OpenVPN\
4 Edit the openVPN configuration files (ending with .ovpn) with a text editor like Notepad++.
5 Add full path to all .crt .key .txt file names inside the configuration files and separate folder names with double back slash \\. And put the file name with path inside quotation marks. For example, change
ca v10.crt to

ca "\\My Storage\\Program Files\\OpenVPN\\Config\\v10.crt"

change key xxx.key to

key "\\My Storage\\Program Files\\OpenVPN\\Config\\xxx.key"

6 delete

#route-delay
route-method exe

7. Copy the edited file to the Config folder of your OpenVPN installation folder in your cell phone.
8. Go back to “Today” desktop of your PPC. You will find a small screen icon on the bottom right. Click “utils” and then “setting”. Then you will find two “settings” inside. In the first one, uncheck “Try to ping servers on connect”. In the second “Settings” choose your internet connection. Finally Click “tap” and then click “tap device 1” and press “start”. You will get a message: “This adapter is already loaded”.
9. Click the little screen icon on the desktop –>Start from Config—>and click a server name.
10. A few seconds later, you will prompted “LAN discovered” and click OK. The little screen icon turns green.
11. Now you are connected to your OpenVPN server!

Share

Easy steps to correct the incorrect VPS time

When you get a VPS outside your own territory the time-zone is unlikely correct. Not only that, sometimes the VPS clock is just wrong: it can be 10 to 20 minutes faster or slower. You are happy after correcting it, not not too long as the clock will be wrong again after a reboot. This guide is for CentoOS 5.x

Here is a solution: submit a ticket to your provider:-)

I don’t want to bother those busy guys (almost always men) unless there is no other way. So if you are like me, follow those steps:

Step 1: Edit /etc/sysctl.conf and add this line (if you are using Xen):

xen.independent_wallclock=1

Step 2: Save the file and exit and then run at the command line

sysctl -p

Step 3: Set up your local time. Go to the /usr/share/zoneinfo/ (easier on SFTP) and find your correct time zone file. Remember the location and file name (writing it in notepad or on paper). For example, mine is:

/usr/share/zoneinfo/Asia/Shanghai

Then run the following code at the command line (Replacing /usr/share/zoneinfo/Asia/Shanghai with yours)


rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
yum install -y ntp
ntpdate us.pool.ntp.org
date

Bingo! The time is correct, finally! But don’t be happy too early. You will still need to do one last step.

Step 4: Edit file /etc/rc.local and add the following line:

ntpdate us.pool.ntp.org

In this way, your VPS will sync time automatically with us.pool.ntp.org server, not local BIOS.

Share