Archive for the ‘Uncategorized’ Category

hackedOccasionally you need to mirror a website (or a directory inside one). If you’ve only got HTTP access, there are tools like httrack which are pretty good (albeit pretty ugly) at doing this. However, as far as I can tell, you can’t use httrack on a password-protected website.

curl can probably do this too, and supports authentication, but it wasn’t obvious.

So I ended up using wget, as it supports mirroring and credentials. But the issue here is that wget plays nice and respects robots.txt; which can actually prevent you mirroring a site you own. And nothing in the man page explains how to ignore robots.txt.

Eventually, I came up with this incantation, which works for me (access to password-protected site, full mirror, ignoring robots.txt):

wget -e robots=off --wait 1 -x --user=xxx --password=xxx -m -k http://web_site_name_to_mirror/

where:

  • -e robots=off obviously disables robots
  • –wait 1 forces a pause between gets (so the site doesn’t get hammered)
  • –user and –password: self-evident
  • -x creates a local directory structure which “mirrors” (see what I did there?) the directory structure on the site you’re mirroring
  • -m turns on mirror mode: “turns on recursion and time-stamping, sets infinite recursion depth and keeps FTP directory listings” (from the man page)
  • -k converts links after download so that URLs in the mirrored files reference local files

Don’t use it carelessly on someone else’s website, as they might get angry…

Advertisements

The steps below are general Ethernet Category 5 (commonly known as Cat 5) cable construction guidelines. For our example, we will be making a Category 5e patch cable, but the same general method will work for making any category of network cables.

Steps
  1. Unroll the required length of network cable and add a little extra wire, just in case. If a boot is to be fitted, do so before stripping away the sleeve and ensure the boot faces the correct way.
  2. Carefully remove the outer jacket of the cable.

    Carefully remove the outer jacket of the cable. Be careful when stripping the jacket as to not nick or cut the internal wiring. One good way to do this is to cut lengthwise with snips or a knife along the side of the cable, away from yourself, about an inch toward the open end. This reduces the risk of nicking the wires’ insulation. Locate the string inside with the wires, or if no string is found, use the wires themselves to unzip the sheath of the cable by holding the sheath in one hand and pulling sideways with the string or wire. Cut away the unzipped sheath and cut the twisted pairs about 1 1/4″ (30 mm). You will notice 8 wires twisted in 4 pairs. Each pair will have one wire of a certain color and another wire that is white with a colored stripe matching its partner (this wire is called a tracer).

  3. Inspect the newly revealed wires for any cuts or scrapes that expose the copper wire inside.

    Inspect the newly revealed wires for any cuts or scrapes that expose the copper wire inside. If you have breached the protective sheath of any wire, you will need to cut the entire segment of wires off and start over at step one. Exposed copper wire will lead to cross-talk, poor performance or no connectivity at all. It is important that the jacket for all network cables remains intact.

  4. Untwist the pairs so they will lay flat between your fingers.

    Untwist the pairs so they will lay flat between your fingers. The white piece of thread can be cut off even with the jacket and disposed (see Warnings). For easier handling, cut the wires so that they are 3/4″ (19 mm) long from the base of the jacket and even in length.

  5. Arrange the wires based on the wiring specifications you are following.

    Arrange the wires based on the wiring specifications you are following. There are two methods set by the TIA, 568A and 568B. Which one you use will depend on what is being connected. A straight-through cable is used to connect two different-layer devices (e.g. a hub and a PC). Two like devices normally require a cross-over cable. The difference between the two is that a straight-through cable has both ends wired identically with 568B, while a cross-over cable has one end wired 568A and the other end wired 568B.  For our demonstration in the following steps, we will use 568B, but the instructions can easily be adapted to 568A.

    • 568B – Put the wires in the following order, from left to right:
      • white orange
      • orange
      • white green
      • blue
      • white blue
      • green
      • white brown
      • brown
    • 568A – from left to right:
      • white/green
      • green
      • white/orange
      • blue
      • white/blue
      • orange
      • white/brown
      • brown
  6. You can also use the mnemonic 1-2-3-6/3-6-1-2 to remember which wires are switched.
    Image:Rj45568AB_955.gif
  7. Press all the wires flat and parallel between your thumb and forefinger. Verify the colors have remained in the correct order. Cut the top of the wires even with one another so that they are 1/2″ (12.5 mm) long from the base of the jacket, as the jacket needs to go into the 8P8C connector by about 1/8″, meaning that you only have a 1/2″ of room for the individual cables. Leaving more than 1/2″ untwisted can jeopardize connectivity and quality. Ensure that the cut leaves the wires even and clean; failure to do so may cause the wire not to make contact inside the jack and could lead to wrongly guided cores inside the plug.
  8. Keep the wires flat and in order as you push them into the RJ-45 plug with the flat surface of the plug on top.

    Keep the wires flat and in order as you push them into the RJ-45 plug with the flat surface of the plug on top. The white/orange wire should be on the left if you’re looking down at the jack. You can tell if all the wires made it into the jack and maintain their positions by looking head-on at the plug. You should be able to see a wire located in each hole, as seen at the bottom right. You may have to use a little effort to push the pairs firmly into the plug. The cabling jacket should also enter the rear of the jack about 1/4″ (6 mm) to help secure the cable once the plug is crimped. You may need to stretch the sleeve to the proper length. Verify that the sequence is still correct before crimping.

  9. Place the wired plug into the crimping tool.

    Place the wired plug into the crimping tool. Give the handle a firm squeeze. You should hear a ratcheting noise as you continue. Once you have completed the crimp, the handle will reset to the open position. To ensure all pins are set, some prefer to double-crimp by repeating this step.

  10. Repeat all of the above steps with the other end of the cable. The way you wire the other end (568A or 568B) will depend on whether you’re making a straight-through, rollover, or cross-over cable (see Tips).
  11. Test the cable to ensure that it will function in the field.

    Test the cable to ensure that it will function in the field.
    Mis-wired and incomplete network cables could lead to headaches down the road. In addition, with power-over-Ethernet (PoE) making its way into the market place, crossed wire pairs could lead to physical damage of computers or phone system equipment, making it even more crucial that the pairs are in the correct order. A simple cable tester can quickly verify that information for you. Should you not have a network cable tester on hand, simply test connectivity pin to pin.
    [Or Check directly by inserting into your Router and PC]

    Tips
    • CAT5 and CAT5e are very similar cables, however CAT5e offers better quality especially on longer runs. If making a longer run, CAT5e is recommended, however CAT5 is still an option for small patch cables.
    • A key point to remember in making Ethernet patch cords is that the “twists” in the individual pairs should remain entwined as long as possible until they reach the RJ-45 plug termination. The twisting of the pairs in the network cable is what helps to ensure good connectivity and keeps cross-talk interference to a minimum. Do not untwist the wires any more than you need to.
    • A good idea on the long runs, especially those that you need to hang or snake around, is to crimp and test the cable before you run the cable. This is recommended especially to anyone who is first starting out crimping their own cables, as it ensures you are crimping the correct pin order now, rather than trying to trouble shoot later.
    • Always keep a box of Network Cable resting on one of the four ‘end’ surfaces, never on one of its two sides. This prevents loops falling across each other inside the box causing binding and knots.
    Warnings
    • Fire Codes require a special type of cover over the wires if the cabling is to be installed in ceilings or other areas that are exposed to the building ventilation system. This is usually referred to as plenum-grade cable or simply “plenum cable”, and does not release toxic fumes when burned. Plenum cabling is more costly, perhaps double that of ordinary cable, so only use where necessary. Riser cable is similar to plenum, but is for use in walls or wiring closets to connect floors. Riser may not replace plenum cable so be aware of what area you are laying your cable. If in doubt, use plenum as it has the strictest and safest ratings.
    • RJ-45 is the common term most individuals use for the connectors present in CAT5 cabling. The correct name of the connector is simply 8P8C, where as RJ-45 is the name of a very similar looking defunct connector used in telecommunication. Most people will understand RJ-45 as 8P8C, but be careful when purchasing out of a catalog or online where you can’t visibly determine which you are purchasing.
    • Unless you need to do a large amount of cabling work, it may be less frustrating and, due to the cost of tools, less expensive to purchase ready-made cables.
    • A cat5 cable can not exceed 100 meters, or 328 feet. It probably shouldn’t go beyond 300 feet.
    • The ripcords, if present, are usually quite strong, so do not attempt to break them. Cut them.
    • Be aware of any shielding your cable may have. The most common type of cable is UTP (Unshielded Twisted Pair), but a number of shielding/foiling options exist for added protection against EMI. Be aware of what you are purchasing and what you need. In most environments, UTP will be fine.
    Things You’ll Need
    • Crimper – This is the most essential tool and critical to the cable making process. If you don’t have a quality crimper, then your cable connections will be bad. Inferior crimpers will make it difficult and/or nearly impossible to achieve a tight connection between the wires. Many better quality crimpers also have a ratcheting controlled closure for precise crimping. Crimpers with a plastic body will be more likely to develop a sloppy hip joint and give consistently poor cramps; a metal crimper is much preferred, and very common.
    • Tester (Optional) – Although not necessary for making cables, having a good cable tester can prevent and solve cable wiring configuration and installation problems. Most testers consist of two boxes (transmitter and receiver) you plug your patch cable into. The transmitter box tests the cable by sending test pulses down each individual wire, lighting up LED lights on the receiver box. Most testers will show you a result of the pass. Why do you want to test cables? Even if they are slightly damaged, network cables will work, but cause packet loss and data corruption to your hardware.
    • RJ45 Connectors – Ensure your RJ45 connectors are designed for the type of cable you are using (solid/stranded), as they have different types of teeth for piercing between multiple strands or around a solid single strand. Note: if you ask in an electrical trades store for RJ45 connectors, you may be asked whether you want “solid”, “stranded” or “flat”. The “flat” choice relates to the old flat “silver satin” cables used in 10Base-T, and should not be used in new Ethernet deployments.
    • Bulk Cable – Bulk cable can be found at computer stores, electrical stores, and home centers. You can obtain Category 5, Category 5e, and Category 6 cable, depending on your needs. For lengths shorter than 50′ use a stranded/braided cable. For lengths greater than 50′ use a solid cable.
      • There are two types of wire (solid or stranded) and which one you choose should be based on where and how the patch cable is to be used. See warning above about PLENUM cable. Stranded wire is best for a workstation patch as it can tolerate flexing without cracking the conductors; however, the trade off is that they’re more susceptible to moisture penetration.[2] Solid is best used in a wire closet or for a patch that will be moved very infrequently, as the conductor tends to crack if bent and/or flexed. Cracked conductor leads to “reflections” which make for chatter on the LAN connection, hampering speed and reliability.
    • Boots (optional but preferred). It saves the cable in the long run and improves the looks. A boot is a molded piece of plastic that protects the connector from snagging, if it is pulled through the wall or conduit. It also provides strain relief on the cable, making it harder for the connector to be pulled off.
    • Straight edge wire cutter. You may find serrated snips work very nicely. Use something that gives an easy square cut; avoid diagonal pliers for this reason. You will find that many quality crimpers have a straight edge cutter built in.
    • Fish Tape – Fish tape is either a metal or plastic spool of guide wire. Strong enough not to buckle and bend while being pushed around, but flexible enough to be pushed past corners and bends, fish tape is a vital tool for some cable runs. Recommended conditions include: conduit, within walls, along structural beams and girders, in ducting, plenums, and dropped ceilings, or any situation where it’s not physically possible to drag the cable along with you.

    [ Also, Look for:  What Is The Difference Between Cat 5, Cat 5e, and Cat 6 Cable?]

6 Stages of Linux Boot Process

Press the power button on your system, and after few moments you see the Linux login prompt.

Have you ever wondered what happens behind the scenes from the time you press the power button until the Linux login prompt appears?

The following are the 6 high level stages of a typical Linux boot process.

1. BIOS

  • BIOS stands for Basic Input/Output System
  • Performs some system integrity checks
  • Searches, loads, and executes the boot loader program.
  • It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key (typically F12 of F2, but it depends on your system) during the BIOS startup to change the boot sequence.
  • Once the boot loader program is detected and loaded into the memory, BIOS gives the control to it.
  • So, in simple terms BIOS loads and executes the MBR boot loader.

2. MBR

  • MBR stands for Master Boot Record.
  • It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda
  • MBR is less than 512 bytes in size. This has three components 1) primary boot loader info in 1st 446 bytes 2) partition table info in next 64 bytes 3) mbr validation check in last 2 bytes.
  • It contains information about GRUB (or LILO in old systems).
  • So, in simple terms MBR loads and executes the GRUB boot loader.

3. GRUB

    • GRUB stands for Grand Unified Bootloader.
    • If you have multiple kernel images installed on your system, you can choose which one to be executed.
    • GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file.
    • GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t understand filesystem).
    • Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). The following is sample grub.conf of CentOS.
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.el5PAE)
          root (hd0,0)
          kernel /boot/vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/
          initrd /boot/initrd-2.6.18-194.el5PAE.img
  • As you notice from the above info, it contains kernel and initrd image.
  • So, in simple terms GRUB just loads and executes Kernel and initrd images.

4. Kernel

  • Mounts the root file system as specified in the “root=” in grub.conf
  • Kernel executes the /sbin/init program
  • Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.
  • initrd stands for Initial RAM Disk.
  • initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.

5. Init

  • Looks at the /etc/inittab file to decide the Linux run level.
  • Following are the available run levels
    • 0 – halt
    • 1 – Single user mode
    • 2 – Multiuser, without NFS
    • 3 – Full multiuser mode
    • 4 – unused
    • 5 – X11
    • 6 – reboot
  • Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program.
  • Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run level
  • If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that.
  • Typically you would set the default run level to either 3 or 5.

6. Runlevel programs

  • When the Linux system is booting up, you might see various services getting started. For example, it might say “starting sendmail …. OK”. Those are the runlevel programs, executed from the run level directory as defined by your run level.
  • Depending on your default init level setting, the system will execute the programs from one of the following directories.
    • Run level 0 – /etc/rc.d/rc0.d/
    • Run level 1 – /etc/rc.d/rc1.d/
    • Run level 2 – /etc/rc.d/rc2.d/
    • Run level 3 – /etc/rc.d/rc3.d/
    • Run level 4 – /etc/rc.d/rc4.d/
    • Run level 5 – /etc/rc.d/rc5.d/
    • Run level 6 – /etc/rc.d/rc6.d/
  • Please note that there are also symbolic links available for these directory under /etc directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d.
  • Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K.
  • Programs starts with S are used during startup. S for startup.
  • Programs starts with K are used during shutdown. K for kill.
  • There are numbers right next to S and K in the program names. Those are the sequence number in which the programs should be started or killed.
  • For example, S12syslog is to start the syslog deamon, which has the sequence number of 12. S80sendmail is to start the sendmail daemon, which has the sequence number of 80. So, syslog program will be started before sendmail.

There you have it. That is what happens during the Linux boot process

ImageTop 10 Clever Tricks Built Right Into Gmail

Gmail is amazing. It’s chock full of more shortcuts, settings, and features than you could shake a stick at. Even if you consider yourself a Gmail ninja, though, there are quite a few tricks you might not know about (and some that Google didn’t even intend). Here are our top 10 clever tricks built right into Gmail.

10. Host Files in Your Email Inbox for Easy Access

Top 10 Clever Tricks Built Right Into GmailThese days, most of us have an account with a service like Dropbox for quick access to any files we want to store in the cloud. However, if you don’t use Dropbox (or if you just want a file or two even closer at hand), you can just attach them to a draft in Gmail and leave them there. That way, they’re only a few clicks away, and you don’t even need to open up a new tab to get them.

9. Keep Track of Your Home IP Address

There are a lot of services that require you to know the IP address of one of your computers, like remote control, streaming your media, and more. The problem is, that IP can change from time to time, leaving you without a connection. While you could always set up DynDNS or Hamachi to ensure easy access, you can also just check Gmail’s account activity. As long as you’ve accessed Gmail recently from home (and who hasn’t?), it’ll show you the last used IP address of your home computer so you can always connect to it.

8. Strip Your Emails of Annoying Text Formatting

If you’ve ever copied and pasted text into Gmail, you know how annoying it is that it keeps the text’s original formatting. If you want to turn that huge, poorly-chosen font into Gmail’s default, you don’t need to resort to pasting it in Notepad first—you can just click Gmail’s “Remove Formatting” button (yeah, I didn’t know that’s what that button did either). I’ll instantly remove the properties of all your email’s text, no hassle required.

7. Restore Your Contacts List if You Mess It Up

You may not know this, but Gmail automatically backs up your contact list regularly, so if you ever mess it up—lose a contact, accidentally sync an older set of contacts, or even delete your entire address book by accident, you can restore it to exactly the way it was at any point in time. Just head to your contact list in Gmail, click the “More” button, and choose “Restore Contacts”.

6. Copy and Paste Image Directly Into Messages

If you share a lot of photos, you don’t actually have to click that “Insert Image” button whenever you want to embed a picture in an email. In both Firefox and Chrome, you can just drag images right into messages and drop them there to insert them. You can also copy and paste images from the web, which is particularly handy if you don’t want to download an image to your desktop first.

5. Sort Gmail Messages by Size and Get Rid of Data Hogs

If you’ve started to run out of space in your Gmail account, you have a choice: buy more space (lame) or see if you have any messages and attachments that you can delete to free some up (preferable). This cool Google Docs script will grab your largest messages and sort them by size, so you can see which ones are taking up the most space. It isn’t exactly “built in” to Gmail, but you never have to leave Google Apps or give someone else access to your account to make it work!

4. Set Up Gmail on iOS Like It was Meant to Be

Some of you more experienced Gmail users may know this “trick” already, but it’s surprising how many people are still syncing their iPhone with their computer to get their contacts, when you can sync everything over the air. Check out these instructions to see how to set up Gmail, Google Calendar, and Google Contacts on iOS and get everything syncing over the air. After setting it up, your contacts and calendar should always be up to date whether or not you’ve synced, and your email notifications should come in instantly. Of course, Android users need not worry—Android does all this out of the box.

3. Access Gmail When It’s Down

Google’s usually pretty good about not having downtime, but every once in a while, Gmail becomes inaccessible and everyone panics. Luckily, even when it’s down, there is a multitude of ways to still get your messages—and usually it’s as simple as accessing the HTML interface or viewing it through a mail client like Thunderbird. Brush up on these tricks so you know exactly what to do the next time Gmail decides to take a day off.

2. Set Gmail As Your Default Mail Client

Back in the day, it took a desktop app, hacky workaround, or other annoying method to set Gmail as your default mail client, but now these features are built right into Chrome and Firefox. For Chrome, Gmail should have asked you when this feature first went live, but if you said “no” at the time, you can go to chrome://settings/handlers and change the Gmail setting to apply it. In Firefox, you can find a similar setting in Options > Applications. Note that, while these don’t require any external apps, they’ll only work inside the browser—so if you click a link in another app, it won’t automatically send you to Gmail unless you install something like Google’s Gmail Notifier.

1. Add a Snooze Button to Gmail

This one requires a bit more work, but again, you never have to install any extension or sign up for a service to get it working—you just need a simple Google Apps script. Once you set it up, it’ll let you “snooze” an email for a certain number of days. When that number of days passes, the email will be marked as new again, reminding you to act on that email now (just like a snooze alarm on your phone). Check out our full guide on how to set it up.


Some of these are lesser known Gmail features and some of them are actually MacGyver-caliber tricks, but they’re all useful things you can do with Gmail that you might not have thought of—and none of them require any extra extensions or apps. For more awesome Gmail tips, check out our guide to mastering the new Gmail as well as our top 10 Gmail Labs (not to mention 10 other labs you should enable). And, if you have your own clever uses for Gmail, be sure to share them in the comments below.

Open-source hardware

Posted: December 20, 2012 in Uncategorized

Open-source hardware

Open-source hardware (OSHW) consists of physical artifacts of technology designed and offered by the Open design movement. Both free and open-source software (FOSS) as well as open-source hardware is created by this open-source culture movement and applies a like concept to a variety of components. The term usually means that information about the hardware is easily discerned. Hardware design (i.e. mechanical drawings, schematics, bill of materials, PCB layout data, HDL source code and integrated circuit layout data), in addition to the software that drives the hardware, are all released with the FOSS approach.

Since the rise of reconfigurable programmable logic devices, sharing of logic designs has been a form of open source hardware. Instead of the schematics, hardware description language (HDL) code is shared. HDL descriptions are commonly used to set up system-on-a-chip systems either in field-programmable gate arrays (FPGA) or directly in application-specific integrated circuit (ASIC) designs. HDL modules, when distributed, are called semiconductor intellectual property cores, or IP cores.

Nepal Open Source Klub

Posted: December 20, 2012 in Uncategorized

Nepal Open Source Klub