Category Archives: Computer Tips

enable virutal memory on linux debian

Most of the time, virtual memory is enabled by default on linux, in case it’s not there, run below commands:
cd /var
touch swap.img
chmod 600 swap.img
dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
mkswap /var/swap.img
swapon /var/swap.img
echo "/var/swap.img none swap sw 0 0" >> /etc/fstab

And you can use this command to check for memory status:

curl download files with the file name from server

To download files with the file name from server with curl, you need to specify this command:
curl -O -J -L

And this is the explanation of the command switch used:
-O, –remote-name Write output to a file named as the remote file
-J, –remote-header-name Use the header-provided filename (H)
-L, –location Follow redirects (H)

build openvpn from command line

first download the source and cd to the extracted directory, you should run follow commands:

tar -zxvpf openvpn-2.3.4.tar.gz
cd openvpn-2.3.4
aptitude install libssl-dev liblzo2-dev libpam0g-dev gcc make -y
make install

auto mount a windows folder share on debian startup for development purpose

Auto mount a windows folder share on debian startup could be your honey if you run into this situation:
1. run linux as a website server development environment
2. most of your tools with good ui only run under windows
To bridge this gap, you want to have linux access to your windows share, and this is how to do it:
work on the windows:

  1. create a user “linuxweb” with the password “1y1cc1″ (please use your own values in your situation)
  2. share your work folder as “workproject” and make sure the user “linuxweb” you created have all the permission

work on the linux:

  1. create the mount point by these commands:
    mkdir /website
    mkdir /website/winworkproject
  2. setup auto mount on debian boot, run:
    pico /etc/rc.local
    and add this line to the file:
    mount -t cifs // -o username=linuxweb,password=1y1cc1,uid=www-data,gid=www-data /website/winworkproject

One problem:
There is one problem I run into during this adventure: I initially tried to auto mount the share by fstab:
// /website/winworkproject cifs username=linuxweb,password=1y1cc1,uid=www-data,gid=www-data 0 0
but got an error saying:
CIFS VFS: cifs_mount failed w/return code = -112
I have no clue what code -112 is, then I have to do it by rc.local and it looks work well. Please leave a comment below if you know what code -112 is, thanks!

sendmail is being slow on linux

sendmail is very easy to install and use with php on linux. But it could be slow by default configuration. The reason which I ran into is because the server doesn’t configured with a qualified host name and it keeps retrying. To fix the issue:
and set the ip for your domain like this:

I haven’t got the whole picture of this, but this quick fix does work. Hope it could also help you if you are demand a quick solution.

programmer’s blog with good stuff and a list of great tools&library

List of programmer’s blog with cool stuff
Some .net related good posts:
Graphical programmer:
Great .net programmer writes excellent codeproject article:

List of platform:
Open slim:

List of tools:
ilmerge, merge .net dll and exe into one:
windows api monitor:

List of library:
Take directx and multimedia api to .net:
GraphicsMagick is a folk of ImageMagick, it’s an image manipulation library, speed faster and size smaller than ImageMagick:

synthesia, on screen midi keyboard and even more: