tar is used to create a Tape ARchive. The resulting file is known as a tarball. It's pretty much the same concept as a ZIP file, if you know what they are, but without the compression. To get the files out of a tarball, you can use the following commands:tar xvf something.tarIf the tarball has also been gzipped (compressed), you can use the following command: tar xvfz something.tar.gzIf you only want certain directories from the tarball, do this: tar xvzf something.tar.gz */dir.you.want/*If you have a .tar.bz2 file, then you need bzip2 installed (/usr/ports/archivers/bzip2), and you issue this command: |
tar |
To tar up *.db in the current directory into a tarball called blah.tar.gz, issue this command:The z option compresses.tar cfz blah.tar.gz *.db |
listing the contents |
To see a list of the files within a tarball, issue the following command:The -t provides a list. the -z indicates that the tarball is compressed. The -f identifies the tarball.tar -tzf blah.tar.gz Here's an example: # tar -tzf makeworld.991126.tgz etc/ etc/protocols etc/aliases etc/services etc/hosts |
Wednesday, December 28, 2011
Extract tar.gz File
Swipe JS a very useful tool for native-like swiping
Swipe JS brings content sliding to the mobile web to preserve space and allow for new types of interaction. Many mobile web sliders currently exist but few embody all the rules a slider like this should follow.
1:1 touch movement
1:1 movement, as described above, is about tracking the position of the touch and moving the content exactly how the touch interacts. This interaction is very common in native apps.
Resistant bounds
When Swipe is at the left-most position, sliding any more left will increase the resistance to slide, making it obvious that you have reached the end. This detection/resistance occurs at both left and right bounds.
Rotation/resize adjustment
When a user rotates their device (in turn resizing the browser window), the slider resets to make sure the sliding elements are the right size. This is only necessary for sliders without declared widths.
Variable width containers
Swipe allows you to set a width to the container, which designates the width of each slide element. This is important if you do not want a full width slider (the default).
Scroll prevention
Scroll prevention is one of the most overlooked pieces of mobile sliders. Swipe detects if you’re trying to scroll down the page or slide content left to right.
Library agnostic
Swipe doesn’t rely on any library. Trust me this is a good thing. All you have to do is pass in the container element, set some parameters, and BOOM goes the dynamite– you're all set. You may choose to pass the element to Swipe with a library, but it’s not necessary.
Monday, March 7, 2011
Showing Or Saving An Image Retrieved Via cURL
Thursday, March 3, 2011
Piping Output from One Command to Another
Examples:
| See if a program, centericq, is running:$ ps ax | grep centericq 25824 pts/2 S 0:18 centericq Count the number of files in a directory (nl counts things):$ ls | nl 1 #.emacs# 2 BitchX 3 Outcast double cd.lst 4 bm.shader 5 bmtexturesbase.pk3 If my memory serves using RPM to check if a package is installed:$ rpm -qa | grep package_name A more advance example:$ cat /etc/passwd | awk -F: '{print $1 "\t" $6}' | sort > ./users This sequence takes the information if the file passwd, pipes it to awk, which takes the first and sixth fields (the user name and home directory respectively), pipes these fields separated by a tab ("\t") to sort, which sorts the list alphabetically, and puts it into a file called users. |
Wednesday, March 2, 2011
PHP POST Upload File Using CURL
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: | <?php $data = array ( 'type' => 'direct', 'userfile[]' => '@c:\Apache Server Doc Folder\picture.jpg', 'private' => '0', ); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "http://www.url.com/upload.php"); curl_setopt($curl, CURLOPT_VERBOSE, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); $result = curl_exec($curl); curl_close($curl); ?> |
And there is a reference for POST JSON here :
http://www.lornajane.net/posts/2011/posting-json-data-with-php-curl
Login with cURL and PHP
Saturday, February 19, 2011
Sending email or mail with attachment from command or shell prompt
Friday, February 18, 2011
Tuesday, February 15, 2011
sudoers file
The file /etc/sudoers, has the rules that users have to follow when using sudo command.
If you are (or was) running Ubuntu, you may know that by default the root account is not usable in Ubuntu, because it has no password, you may assign one and use it as in every other Linux, but that is another story. On normal Ubuntu Linux machines you need to use sudo command to perform operations as root.I like that approach, and even though I am using Debian, I always give my account root rights, so I can run commands as root without changing to root.
Comics from XKCDAs you can see from this funny picture, using sudo makes your system reacts as if was another user who are given the order.Two of the best advantages about using sudo are:- Restringed privileges
- Logs of the actions done by users
Well but in order to use sudo we first need to configure the sudoers file.
The file /etc/sudoers, has the rules that users have to follow when using sudo command.
If you are (or was) running Ubuntu, you may know that by default the root account is not usable in Ubuntu, because it has no password, you may assign one and use it as in every other Linux, but that is another story. On normal Ubuntu Linux machines you need to use sudo command to perform operations as root.I like that approach, and even though I am using Debian, I always give my account root rights, so I can run commands as root without changing to root.
Comics from XKCDAs you can see from this funny picture, using sudo makes your system reacts as if was another user who are given the order.Two of the best advantages about using sudo are:- Restringed privileges
- Logs of the actions done by users
Well but in order to use sudo we first need to configure the sudoers file.
- Restringed privileges
- Logs of the actions done by users
Monday, February 14, 2011
Make batch scripts in Linux
This is a tutorial about how to create simple batch scripts in linux console. I will use "/home/" as my root folder. It can be applied on any folder.
First, I'll Create a file known as "mybatch", if the file does not already exist. If the file already exists the accessed / modification time is updated for the file mybatch
touch /home/mybatch
Sunday, February 13, 2011
Building Custom WordPress Theme
1. The Blog Frontend
Before you start, let’s take a look at the WordPress default theme and see how it is structured. Take note of the elements (header, post title, search form, navigation, footer, etc.).Perfect Setup: Ubuntu Hardy + Nginx + MySQL5 + PHP5 + Wordress
The Perfect Setup:
Ubuntu Server 8.04.1 LTS Hardy (supported to 2013) + EngineX (NGINX) Web Server built from sources + MySQL 5 + PHP 5.
(Or LEMP )Tested on 256MB VPS slice at SliceHost. Should work for other hardware.From baremetal/barebone/empty fresh install of Ubuntu Server to shiny, fast and SEO-friendly WordPress Portal propelled by WP Super Cache plugin.
All configured and powered by NGinx WEB Server.
Step by step copy/paste instructions - from "zero to hero" with everything on a single page (albeit long one) and in the right order. Just what your granma was asking for!Every time I need to quickly utilize new product or technology it always made me wonder "why don't someone came up with a simple step by step instructions on which buttons to press to make this thing work?". So instead of waiting for someone to do it this time I decided to make one myself.After spending countless hours and days hunting for scripts, searching for clues, scrolling through misleading posts, extracting bits from articles, eliminating blubber and fluff, bugging busy geeky people for hints and getting all necessary pieces together in the right order I finally came up with this instructional post. It all boils down to step-by-step copy/paste instructions that should take you less than 1 hour to get from freshly installed Ubunty server to fully functioning, search engine optimized business-ready WordPress-powered website.I tested it all on 256MB VPS image offered by SliceHost but the same instructions should work just just fine on any real hardware as well.
Most credits goes to excellent set of articles by PickedOnion at SliceHost plus to some more sources, acknowledged within this post.This article assumes your username is 'jsmith' and your domain is 'mydomain.com'.Now it's time to get our hands dirty!
(Or LEMP )
All configured and powered by NGinx WEB Server.
Step by step copy/paste instructions - from "zero to hero" with everything on a single page (albeit long one) and in the right order. Just what your granma was asking for!
Most credits goes to excellent set of articles by PickedOnion at SliceHost plus to some more sources, acknowledged within this post.