Copy large number of files in one directory

I have one directory that contains ~200k small files on nfs. I want to copy them to a local directory. I tried many methods, all of them failed due to lack of memory. Bascially, they try to analyze the files in the same directories before doing the real work.

I tried:

1. "cp -ufpr sourcedir destdir",
2. "rsync -axS sourcedir destdir",
3. "find sourcedir -exec cp -ufp {} destdir \;",
4. "find sourcedir | xargs -0 cp -ufp -t destdir" and
5. "tar -c sourcedir | tar -xvf - -C destdir".

Create Bootable Multi-OS Flash Drive from Scratch using GRUB

I have the idea for creating my own bootable flash drive for long. For maintanance purposes, I need PE and BackTrack. The existing tools are all intended to boot one OS. I have two flash drives, so I could put PE on one and BT on the other. Recently, I find that Ubuntu's Live-CD is useful, which can be used to administrate the system and install UB on them. I don't have a third flash drive, so I go and find a way to create a bootable flash drive myself.

Tunnel Through Firewall using Reverse SSH and VPN with DD-WRT

Suppose you have a Linux box behind a firewall, which is managed by someone else, and you want to remotely connect to your Linux box from home, but can't get any port open. You need to somehow initiate a bridge from inside the firewall to an agent, then you can connect to your Linux box from home via the agent. There are two ways I am using, reverse ssh, and VPN. I am using Ubuntu 10.04LTS. Modify the process according to your distro.

Convert simple iteration and branch into vector operations in Matlab

Some people using Matlab do not really have programming background, for example, my friends in Statistics & Actuarial Science. I passively learnt some basics of Matlab programming. One thing I found in Matlab that is vector operations. One statement that can be applied to all elements in a vector individually. I found that some simple for-loops and if-statements can be converted into vector operations. Vector operations are not only shorter, but also faster especially if you have a supported GPU or multi-core CPU.

Crack Your Neighbour's Wifi Password

I still remember when I was living in a high rise few years ago, most of my neighbour's wifi network was unsecured. These days, most of the home wifi networks are secured. However, many of them are still using the most basic protection, WEP. I was surprised one day when my cousin moved to a new apartment, his friend cracked one wifi network for my cousin to use before the internet guys come. I knew that WEP is not secure anymore, but surprised about how many people are still using it.

Build a VPN for iPhone with only a router

Recently I have researched about two issues. Surprisingly I find out the two issues can be solved together. I was first building a VPN for my friends in China so that they can tunnel through the infamous GFW. All online tutorials suggested setting up a VPN using either Linux or Windows. With some minor struggle, I did manage to setup a VPN for my friends. And later, I tried to look for a solution that can restrict the Internet bandwidth usage of my tenants.

How to compile libxvid under MSYS

Due to a high amount of request for libxvid. I decided to write a separate tutorial for building libxvid under MSYS.

Follow instructions in http://jiang925.com/content/compile-ffmpeg-windows-under-lgpl from 1 to 6.

How to return object and return object reference in Java RMI

Under difference circumstances, a Java RMI call might want to return either an entire object or just a reference of the object, similar to pass by value and pass by reference, respectively. I took me a very long time to figure out how to use different mechanism precisely in different cases. The other guides I found on the Internet, including the Sun's official guide, didn't provide details code-wise. This guide assumes the foundamentals of Java RMI, for example, creating interfaces etc.

First of all, primitive data types like int will be always returned as object.

Get a free port on Unix in C/C++

As a client, you automatically get a free port when you open a connection. As a server, you can get a free port, too, but retrieving the port number is not very trivial. We need to know the port number since we are getting a random free port. If we don't know the port number, this server will be useless. This technique will be very useful for school projects, since you don't know what ports are free on the TA's computer.

 

Open a socket as usual.

int serverfd;
serverfd = socket(AF_INET, SOCK_STREAM, 0);

Virtual machine solution on Windows Server 2008 R2

I was setting up a virtual machine environment on Windows Server 2008 R2. Share my exprience and hope some one will benefit from it.

Virtual PC 2007 and Windows Virtual PC: They are amateur virtual machine environments that have very limited features, so I didn't even try them.

Syndicate content