Tech Cheat

We got your cheat sheets right here
Options:

Wireless Channel Listing

Channel 1 : 2412 Mhz 802.11B/G
Channel 2 : 2417 Mhz 802.11B/G
Channel 3 : 2422 Mhz 802.11B/G
Channel 4 : 2427 Mhz 802.11B/G
Channel 5 : 2432 Mhz 802.11B/G
Channel 6 : 2437 Mhz 802.11B/G
Channel 7 : 2442 Mhz 802.11B/G
Channel 8 : 2447 Mhz 802.11B/G
Channel 9 : 2452 Mhz 802.11B/G леглалаптоп
Channel 10 : 2457 Mhz 802.11B/G
Channel 11 : 2462 Mhz 802.11B/G
Channel 12 : 2467 Mhz 802.11B/G
Channel 13 : 2472 Mhz 802.11B/G

Channel 36 : 5180 Mhz 802.11A
Channel 40 : 5200 Mhz 802.11A
Channel 44 : 5220 Mhz 802.11A
Channel 48 : 5240 Mhz 802.11A
Channel 52 : 5260 Mhz 802.11A
Channel 56 : 5280 Mhz 802.11A
Channel 60 : 5300 Mhz 802.11A
Channel 64 : 5320 Mhz 802.11A
Channel 149 : 5745 Mhz 802.11A
Channel 153 : 5765 Mhz 802.11A
Channel 157 : 5785 Mhz 802.11A
Channel 161 : 5805 Mhz 802.11A
Channel 165 : 5825 Mhz 802.11A

Subnet Cheat Sheet

/30 – 64 Subnets
2 Hosts/Subnet
/29 – 32 Subnets
6 Hosts/Subnet
Network IP Range Broadcast
.0 .1-.2 .3
.4 .5-.6 .7
.8 .9-.10 .11
.12 .13-.14 .15
.16 .17-.18 .19
.20 .21-.22 .23
.24 .25-.26 .27
.28 .29-.30 .31
.32 .33-.34 .35
.36 .37-.38 .39
.40 .41-.42 .43
.44 .45-.46 .47
.48 .49-.50 .51
.52 .53-.54 .55
.56 .57-.58 .59
.60 .61-.62 .63
.64 .65-.66 .67
.68 .69-.70 .71
.72 .73-.74 .75
.76 .77-.78 .79
.80 .81-.82 .83
.84 .85-.86 .87
.88 .89-.90 .91
.92 .93-.94 .95
.96 .97-.98 .99
.100 .101-.102 .103
.104 .105-.106 .107
.108 .109-.110 .111
.112 .113-.114 .115
.116 .117-.118 .119
.120 .121-.122 .123
.124 .125-.126 .127
.128 .129-.130 .131
.132 .133-.134 .135
.136 .137-.138 .139
.140 .141-.142 .143
.144 .145-.146 .147
.148 .149-.150 .151
.152 .153-.154 .155
.156 .157-.158 .159
.160 .161-.162 .163
.164 .165-.166 .167
.168 .169-.170 .171
.172 .173-.174 .175
.176 .177-.178 .179
.180 .181-.182 .183
.184 .185-.186 .187
.188 .189-.190 .191
.192 .193-.194 .195
.196 .197-.198 .199
.200 .201-.202 .203
.204 .205-.206 .207
.208 .209-.210 .211
.212 .213-.214 .215
.216 .217-.218 .219
.220 .221-.222 .223
.224 .225-.226 .227
.228 .229-.230 .231
.232 .233-.234 .235
.236 .237-.238 .239
.240 .241-.242 .243
.244 .245-.246 .247
.248 .249-.250 .251
.252 .253-.254 .255
Network IP Range Broadcast
.0 .1-.6 .7
.8 .9-.14 .15
.16 .17-.22 .23
.24 .25-.30 .31
.32 .33-.38 .39
.40 .41-.46 .47
.48 .49-.54 .55
.56 .57-.62 .63
.64 .65-.70 .71
.72 .73-.78 .79
.80 .81-.86 .87
.88 .89-.94 .95
.96 .97-.102 .103
.104 .105-.110 .111
.112 .113-.118 .119
.120 .121-.126 .127
.128 .129-.134 .135
.136 .137-.142 .143
.144 .145-.150 .151
.152 .153-.158 .159
.160 .161-.166 .167
.168 .169-.174 .175
.176 .177-.182 .183
.184 .185-.190 .191
.192 .193-.198 .199
.200 .201-.206 .207
.208 .209-.214 .215
.216 .217-.222 .223
.224 .225-.230 .231
.232 .233-.238 .239
.240 .241-.246 .247
.248 .249-.254 .255
/28 – 16 Subnets
14 Hosts/Subnet
/27 – 8 Subnets
30 Hosts/Subnet
Network IP Range Broadcast
.0 .1-.14 .15
.16 .17-.30 .31
.32 .33-.46 .47
.48 .49-.62 .63
.64 .65-.78 .79
.80 .81-.94 .95
.96 .97-.110 .111
.112 .113-.126 .127
.128 .129-.142 .143
.144 .145-.158 .159
.160 .161-.174 .175
.176 .177-.190 .191
.192 .193-.206 .207
.208 .209-.222 .223
.224 .225-.238 .239
.240 .241-.254 .255
Network IP Range Broadcast
.0 .1-.30 .31
.32 .33-.62 .63
.64 .65-.94 .95
.96 .97-.126 .127
.128 .129-.158 .159
.160 .161-.190 .191
.192 .193-.222 .223
.224 .225-.254 .255
/26 – 4 Subnets
62 Hosts/Subnet
/25 – 2 Subnets
126 Hosts/Subnet
Network IP Range Broadcast
.0 .1-.62 .63
.64 .65-.126 .127
.128 .129-.190 .191
.192 .193-.254 .255
Network IP Range Broadcast
.0 .1-.126 .127
.128 .129-.254 .255
/24 – 1 Subnets
254 Hosts/Subnet
Network IP Range Broadcast
.0 .1-.254 .255
Small to Large Subnets
CIDR Hosts Netmask Class C’s
/30 4 255.255.255.252 1/64
/29 8 255.255.255.248 1/32
/28 16 255.255.255.240 1/16
/27 32 255.255.255.224 1/8
/26 64 255.255.255.192 1/4
/25 128 255.255.255.128 1/2
/24 256 255.255.255.0 1
/23 512 255.255.254.0 2
/22 1024 255.255.252.0 4
/21 2048 255.255.248.0 8
/20 4096 255.255.240.0 16
/19 8192 255.255.224.0 32
/18 16384 255.255.192.0 64
/17 32768 255.255.128.0 128
/16 65536 255.255.0.0 256
/15 131072 255.254.0.0 512
/14 262144 255.252.0.0 1024
/13 524288 255.248.0.0 2048
/12 1048576 255.240.0.0 4096
/11 2097152 255.224.0.0 8192
/10 4194304 255.192.0.0 16384
/9 8388608 255.128.0.0 32768
/8 16777216 255.0.0.0 65536

For subnetting and general IP tools check here IPThingy.com

Vi Cheat Sheet

Modes
Vi has two modes insertion mode and command mode. The editor begins in command mode, where the cursor movement and text deletion and pasting occur. Insertion mode begins upon entering an insertion or change command. [ESC] returns the editor to command mode (where you can quit, for example by typing :q!). Most commands execute as soon as you type them except for “colon” commands which execute when you press the return key.

Quiting
:x Exit, saving changes
:q Exit as long as there have been no changes
ZZ Exit and save changes if any have been made
:q! Exit and ignore any changes

Inserting Text
i Insert before cursor
I Insert before line
a Append after cursor
A Append after line
o Open a new line after current line
O Open a new line before current line
r Replace one character
R Replace many characters

Motion
h Move left
j Move down
k Move up
l Move right
w Move to next word
W Move to next blank delimited word
b Move to the beginning of the word
B Move to the beginning of blank delimted word
e Move to the end of the word
E Move to the end of Blank delimited word
( Move a sentance back
) Move a sentance forward
{ Move a paragraph back
} Move a paragraph forward
0 Move to the begining of the line
$ Move to the end of the line
1G Move to the first line of the file
G Move to the last line of the file
nG Move to nth line of the file
:n Move to nth line of the file
fc Move forward to c
Fc Move back to c
H Move to top of screen
M Move to middle of screen
L Move to botton of screen
% Move to associated ( ), { }, [ ]

Deleting Text
Almost all deletion commands are performed by typing d followed by a motion. For example, dw deletes a word. A few other deletes are:
x Delete character to the right of cursor
X Delete character to the left of cursor
D Delete to the end of the line
dd Delete current line
:d Delete current line

Yanking Text
Like deletion, almost all yank commands are performed by typing y followed by a motion. For example, y$ yanks to the end of the line. Two other yank commands are:
yy Yank the current line
:y Yank the current line

Changing text
The change command is a deletion command that leaves the editor in insert mode. It is performed by typing c followed by a motion. For wxample cw changes a word. A few other change commands are:
C Change to the end of the line
cc Change the whole line

Putting text
p Put after the position or after the line
P Put before the poition or before the line

Buffers
Named buffers may be specified before any deletion, change, yank or put command. The general prefix has the form “c where c is any lowercase character. for example, “adw deletes a word into buffer a. It may thereafter be put back into text with an appropriate “ap.

Markers
Named markers may be set on any line in a file. Any lower case letter may be a marker name. Markers may also be used as limits for ranges.
mc Set marker c on this line
`c Go to beginning of marker c line.
‘c Go to first non-blank character of marker c line.

Search for strings
/string Search forward for string
?string Search back for string
n Search for next instance of string
N Search for previous instance of string

Replace
The search and replace function is accomplished with the :s command. It is commonly used in combination with ranges or the :g command (below).
:s/pattern/string/flags Replace pattern with string according to flags.
g Flag – Replace all occurences of pattern
c Flag – Confirm replaces.
& Repeat last :s command

Regular Expressions
. (dot) Any single character except newline
* zero or more occurances of any character
[...] Any single character specified in the set
[^...] Any single character not specified in the set
^ Anchor – beginning of the line
$ Anchor – end of line
\< Anchor – begining of word
\> Anchor – end of word
\(…\) Grouping – usually used to group conditions
\n Contents of nth grouping

[...] – Set Examples [A-Z] The SET from Capital A to Capital Z
[a-z] The SET from lowercase a to lowercase z
[0-9] The SET from 0 to 9 (All numerals)
[./=+] The SET containing . (dot), / (slash), =, and +
[-A-F] The SET from Capital A to Capital F and the dash (dashes must be specified first)
[0-9 A-Z] The SET containing all capital letters and digits and a space
[A-Z][a-zA-Z] In the first position, the SET from Capital A to Capital Z
In the second character position, the SET containing all letters

Regular Expression Examples /Hello/ Matches if the line contains the value Hello
/^TEST$/ Matches if the line contains TEST by itself
/^[a-zA-Z]/ Matches if the line starts with any letter
/^[a-z].*/ Matches if the first character of the line is a-z and there is at least one more of any character following it
/2134$/ Matches if line ends with 2134
/\(21|35\)/ Matches is the line contains 21 or 35
Note the use of ( ) with the pipe symbol to specify the ‘or’ condition
/[0-9]*/ Matches if there are zero or more numbers in the line
/^[^#]/ Matches if the first character is not a # in the line
Notes:
1. Regular expressions are case sensitive
2. Regular expressions are to be used where pattern is specified

Counts
Nearly every command may be preceded by a number that specifies how many times it is to be performed. For example, 5dw will delete 5 words and 3fe will move the cursor forward to the 3rd occurence of the letter e. Even insertions may be repeated conveniently with thismethod, say to insert the same line 100 times.

Ranges
Ranges may precede most “colon” commands and cause them to be executed on a line or lines. For example :3,7d would delete lines 3-7. Ranges are commonly combined with the :s command to perform a replacement on several lines, as with :.,$s/pattern/string/g to make a replacement from the current line to the end of the file.
:n,m Range – Lines n-m
:. Range – Current line
:$ Range – Last line
:’c Range – Marker c
:% Range – All lines in file
:g/pattern/ Range – All lines that contain pattern

Files
:w file Write to file
:r file Read file in after line
:n Go to next file
:p Go to previos file
:e file Edit file
!!program Replace line with output from program

Other
~ Toggle upp and lower case
J Join lines
. Repeat last text-changing command
u Undo last change
U Undo all changes to line

Perl Cheat Sheet

  CONTEXTS  SIGILS             ARRAYS        HASHES
  void      $scalar   whole:   @array        %hash
  scalar    @array    slice:   @array[0, 2]  @hash{'a', 'b'}
  list      %hash     element: $array[0]     $hash{'a'}
            &sub
            *glob    SCALAR VALUES
                     number, string, reference, glob, undef
  REFERENCES
  \     references      $$foo[1]       aka $foo->[1]
  $@%&* dereference     $$foo{bar}     aka $foo->{bar}
  []    anon. arrayref  ${$$foo[1]}[2] aka $foo->[1]->[2]
  {}    anon. hashref   ${$$foo[1]}[2] aka $foo->[1][2]
  \()   list of refs
                          NUMBERS vs STRINGS  LINKS
  OPERATOR PRECEDENCE     =          =        perl.plover.com
  ->                      +          .        search.cpan.org
  ++ --                   == !=      eq ne         cpan.org
  **                      < > <= >=  lt gt le ge   pm.org
  ! ~ \ u+ u-             <=>        cmp           tpj.com
  =~ !~                                            perldoc.com
  * / % x                 SYNTAX
  + - .                   for    (LIST) { }, for (a;b;c) { }
  << >>                   while  ( ) { }, until ( ) { }
  named uops              if     ( ) { } elsif ( ) { } else { }
  < > <= >= lt gt le ge   unless ( ) { } elsif ( ) { } else { }
  == != <=> eq ne cmp     for equals foreach (ALWAYS)
  &
  | ^              REGEX METACHARS            REGEX MODIFIERS
  &&               ^     string begin         /i case insens.
  ||               $     str. end (before \n) /m line based ^$
  .. ...           +     one or more          /s . includes \n
  ?:               *     zero or more         /x ign. wh.space
  = += -= *= etc.  ?     zero or one          /g global
  , =>             {3,7} repeat in range
  list ops         ()    capture          REGEX CHARCLASSES
  not              (?:)  no capture       .  == [^\n]
  and              []    character class  \s == [\x20\f\t\r\n]
  or xor           |     alternation      \w == [A-Za-z0-9_]
                   \b    word boundary    \d == [0-9]
                   \z    string end       \S, \W and \D negate
  DO
  use strict;        DON'T            LINKS
  use warnings;      "$foo"           perl.com
  my $var;           $$variable_name  perlmonks.org
  open() or die $!;  `$userinput`     use.perl.org
  use Modules;       /$userinput/     perl.apache.org
                                      parrotcode.org
  FUNCTION RETURN LISTS
  stat      localtime    caller         SPECIAL VARIABLES
   0 dev    0 second     0 package      $_    default variable
   1 ino    1 minute     1 filename     $0    program name
   2 mode   2 hour       2 line         $/    input separator
   3 nlink  3 day        3 subroutine   $\    output separator
   4 uid    4 month-1    4 hasargs      $|    autoflush
   5 gid    5 year-1900  5 wantarray    $!    sys/libcall error
   6 rdev   6 weekday    6 evaltext     $@    eval error
   7 size   7 yearday    7 is_require   $$    process ID
   8 atime  8 is_dst     8 hints        $.    line number
   9 mtime               9 bitmask      @ARGV command line args
  10 ctime  just use                    @INC  include paths
  11 blksz  POSIX::      3..9 only      @_    subroutine args
  12 blcks  strftime!    with EXPR      %ENV  environment

CSS Cheat Sheet

Syntax
selector {property: value;}
External Style Sheet
<link rel=”stylesheet” type=”text/css” href=”style.css” />
Internal Style
<style type=”text/css”>
selector {property: value;}
</style>
Inline Style
<tag style=”property: value”>

General
Class String preceded by a period
ID String preceded by a hash mark
div Formats structure or block of text
span Inline formatting
color Foreground color
cursor Appearance of the cursor
display
block; inline; list-item; none
overflow How content overflowing its box is handled
visible, hidden, scroll, auto
visibility
visible, hidden

Fonts
font-style
Italic, normal
font-variant
normal, small-caps
font-weight
bold, normal, lighter, bolder, integer (100-900)
font-size Size of the font
font-family Specific font(s) to be used

Text
letter-spacing Space between letters
line-height Vertical distance between baselines
text-align Horizontal alignment
text-decoration
blink, line-through, none, overline, underline
text-indent First line indentation
text-transform
capitalize, lowercase, uppercase
vertical-align Vertical alignment
word-spacing Spacing between words

CSS Box
height; width; margin-top; margin-right; margin-bottom; margin-left; padding-top; padding-right; padding-bottom; padding-left;

Border
border-width Width of the border
border-style
dashed; dotted; double; groove; inset; outset; ridge; solid; none
border-color Color of the border

Position
clear Any floating elements around the element?
both, left, right, none
float Floats to a specified side
left, right, none
left The left position of an element
auto, length values (pt, in, cm, px)
top The top position of an element
auto, length values (pt, in, cm, px)
position
static, relative, absolute
z-index Element above or below overlapping elements?
auto, integer (higher numbers on top)

Background
background-color Background color
background-image Background image
background-repeat
repeat, no-repeat, repeat-x, repeat-y
background-attachment Background image scroll with the element?
scroll, fixed
background-position
(x y), top, center, bottom, left, right

List
list-style-type Type of bullet or numbering in the list
disc; circle; square; decimal; lower-roman; upper-roman; lower-alpha; upper-alpha; none
list-style-position Position of the bullet or number in a list
inside; outside
list-style-image Image to be used as the bullet in a list

MySQL Cheat Sheet

 

Selecting a database

mysql> USE database;

Listing databases

mysql> SHOW DATABASES;

Listing tables in a db

mysql> SHOW TABLES;

Describing the format of a table

mysql> DESCRIBE table;

Creating a database

mysql> CREATE DATABASE db_name;

Creating a table

mysql> CREATE TABLE table_name (field1_name TYPE(SIZE), field2_name TYPE(SIZE));
Ex: mysql> CREATE TABLE pet (name VARCHAR(20), sex CHAR(1), birth DATE);

Load tab-delimited data into a table

mysql> LOAD DATA LOCAL INFILE “infile.txt” INTO TABLE table_name;
(Use \n for NULL)

Inserting one row at a time

mysql> INSERT INTO table_name VALUES (’MyName’, ‘MyOwner’, ‘2002-08-31?);
(Use NULL for NULL)

Retrieving information (general)

mysql> SELECT from_columns FROM table WHERE conditions;
All values: SELECT * FROM table;
Some values: SELECT * FROM table WHERE rec_name = “value”;
Multiple critera: SELECT * FROM TABLE WHERE rec1 = “value1? AND rec2 = “value2?;

Reloading a new data set into existing table

mysql> SET AUTOCOMMIT=1; # used for quick recreation of table
mysql> DELETE FROM pet;
mysql> LOAD DATA LOCAL INFILE “infile.txt” INTO TABLE table;

Fixing all records with a certain value

mysql> UPDATE table SET column_name = “new_value” WHERE record_name = “value”;

Selecting specific columns

mysql> SELECT column_name FROM table;

Retrieving unique output records

mysql> SELECT DISTINCT column_name FROM table;

Sorting

mysql> SELECT col1, col2 FROM table ORDER BY col2;
Backwards: SELECT col1, col2 FROM table ORDER BY col2 DESC;

Date calculations

mysql> SELECT CURRENT_DATE, (YEAR(CURRENT_DATE)-YEAR(date_col)) AS time_diff [FROM table];
MONTH(some_date) extracts the month value and DAYOFMONTH() extracts day.

Pattern Matching

mysql> SELECT * FROM table WHERE rec LIKE “blah%”;
(% is wildcard – arbitrary # of chars)
Find 5-char values: SELECT * FROM table WHERE rec like “_____”;
(_ is any single character)

Extended Regular Expression Matching

mysql> SELECT * FROM table WHERE rec RLIKE “^b$”;
(. for char, […] for char class, * for 0 or more instances
^ for beginning, {n} for repeat n times, and $ for end)
(RLIKE or REGEXP)
To force case-sensitivity, use “REGEXP BINARY”

Counting Rows

mysql> SELECT COUNT(*) FROM table;

Grouping with Counting

mysql> SELECT owner, COUNT(*) FROM table GROUP BY owner;
(GROUP BY groups together all records for each ‘owner’)

Selecting from multiple tables

(Example)
mysql> SELECT pet.name, comment FROM pet, event WHERE pet.name = event.name;
(You can join a table to itself to compare by using ‘AS’)

Currently selected database

mysql> SELECT DATABASE();

Maximum value

mysql> SELECT MAX(col_name) AS label FROM table;

Auto-incrementing rows

mysql> CREATE TABLE table (number INT NOT NULL AUTO_INCREMENT, name CHAR(10) NOT NULL);
mysql> INSERT INTO table (name) VALUES (”tom”),(”dick”),(”harry”);

Adding a column to an already-created table

mysql> ALTER TABLE tbl ADD COLUMN [column_create syntax] AFTER col_name;

Removing a column

mysql> ALTER TABLE tbl DROP COLUMN col;
(Full ALTER TABLE syntax available at mysql.com.)

Batch mode (feeding in a script)

# mysql -u user -p < batch_file
(Use -t for nice table layout and -vvv for command echoing.)
Alternatively: mysql> source batch_file;

Backing up a database with mysqldump

# mysqldump –opt -u username -p database > database_backup.sql
(Use ‘mysqldump –opt –all-databases > all_backup.sql’ to backup everything.)

HTML Cheat Sheet

Basic Tags

<html></html>
Creates an HTML document
<head></head>
Sets off the title and other information that isn’t displayed on the Web page itself
<body></body>
Sets off the visible portion of the document

Header Tags

<title></title>
Puts the name of the document in the title bar

Body Attributes

<body bgcolor=?>
Sets the background color, using name or hex value
<body text=?>
Sets the text color, using name or hex value
<body link=?>
Sets the color of links, using name or hex value
<body vlink=?>
Sets the color of followed links, using name or hex value
<body alink=?>
Sets the color of links on click

Text Tags

<pre></pre>
Creates preformatted text
<hl></hl>
Creates the largest headline
<h6></h6>
Creates the smallest headline
<b></b>
Creates bold text
<i></i>
Creates italic text
<tt></tt>
Creates teletype, or typewriter-style text
<cite></cite>
Creates a citation, usually italic
<em></em>
Emphasizes a word (with italic or bold)
<strong></strong>
Emphasizes a word (with italic or bold)
<font size=?></font>
Sets size of font, from 1 to 7)
<font color=?></font>
Sets font color, using name or hex value

Links

<a href=”URL”></a>
Creates a hyperlink
<a href=”mailto:EMAIL”></a>
Creates a mailto link
<a name=”NAME”></a>
Creates a target location within a document
<a href=”#NAME”></a>
Links to that target location from elsewhere in the document

Formatting

<p></p>
Creates a new paragraph
<p align=?>
Aligns a paragraph to the left, right, or center
<br>
Inserts a line break
<blockquote>
</blockquote>
Indents text from both sides
<dl></dl>
Creates a definition list
<dt>
Precedes each definition term
<dd>
Precedes each definition
<ol></ol>
Creates a numbered list
<li></li>
Precedes each list item, and adds a number
<ul></ul>
Creates a bulleted list
<div align=?>
A generic tag used to format large blocks of HTML, also used for stylesheets

Graphical Elements

<img src=”name”>
Adds an image
<img src=”name” align=?>
Aligns an image: left, right, center; bottom, top, middle
<img src=”name” border=?>
Sets size of border around an image
<hr>
Inserts a horizontal rule
<hr size=?>
Sets size (height) of rule
<hr width=?>
Sets width of rule, in percentage or absolute value
<hr noshade>
Creates a rule without a shadow

Tables

<table></table>
Creates a table
<tr></tr>
Sets off each row in a table
<td></td>
Sets off each cell in a row
<th></th>
Sets off the table header (a normal cell with bold, centered text)

Table Attributes

<table border=#>
Sets width of border around table cells
<table cellspacing=#>
Sets amount of space between table cells
<table cellpadding=#>
Sets amount of space between a cell’s border and its contents
<table width=# or %>
Sets width of table – in pixels or as a percentage of document width
<tr align=?> or <td align=?>
Sets alignment for cell(s) (left, center, or right)
<tr valign=?> or <td valign=?>
Sets vertical alignment for cell(s) (top, middle, or bottom)
<td colspan=#>
Sets number of columns a cell should span
<td rowspan=#>
Sets number of rows a cell should span (default=1)
<td nowrap>
Prevents the lines within a cell from being broken to fit

Frames

<frameset></frameset>
tag in a frames document; can also be nested in other framesets
<frameset rows=”value,value”>
Defines the rows within a frameset, using number in pixels, or percentage of w idth
<frameset cols=”value,value”>
Defines the columns within a frameset, using number in pixels, or percentage of width
<frame>
Defines a single frame – or region – within a frameset
<noframes></noframes>
Defines what will appear on browsers that don’t support frames

Frames Attributes

<frame src=”URL”>
Specifies which HTML document should be displayed
<frame name=”name”>
Names the frame, or region, so it may be targeted by other frames
<frame marginwidth=#>
Defines the left and right margins for the frame; must be equal to or greater than 1
<frame marginheight=#>
Defines the top and bottom margins for the frame; must be equal to or greater than 1
<frame scrolling=VALUE>
Sets whether the frame has a scrollbar; value may equal “yes,” “no,” or “auto. ” The default, as in ordinary documents, is auto.
<frame noresize>
Prevents the user from resizing a frame

Forms

For functional forms, you’ll have to run a CGI script. The HTML just creates the appearance of a form.
<form></form>
Creates all forms
<select multiple name=”NAME” size=?></select>
Creates a scrolling menu. Size sets the number of menu items visible before yo u need to scroll.
<option>
Sets off each menu item
<select name=”NAME”></select>
Creates a pulldown menu
<option>
Sets off each menu item
<textarea name=”NAME” cols=40 rows=8></textarea>
Creates a text box area. Columns set the width; rows set the height.
<input type=”checkbox” name=”NAME”>
Creates a checkbox. Text follows tag.
<input type=”radio” name=”NAME” value=”x”>
Creates a radio button. Text follows tag
<input type=text name=”foo” size=20>
Creates a one-line text area. Size sets length, in characters.
<input type=”submit” value=”NAME”>
Creates a Submit button
<input type=”image” border=0 name=”NAME” src=”name.gif”>
Creates a Submit button using an image
<input type=”reset”>
Creates a Reset button

htaccess Cheat Sheet

Enable Directory Browsing

bc.. Options +Indexes

1. block a few types of files from showing
IndexIgnore *.wmv *.mp4 *.avi

Disable Directory Browsing

bc.. Options All -Indexes

Customize Error Messages

bc.. ErrorDocument 403 /forbidden.html
ErrorDocument 404 /notfound.html
ErrorDocument 500 /servererror.html

Get SSI working with HTML/SHTML

bc.. AddType text/html .html
AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml
1. AddHandler server-parsed .htm

Change Default Page (order is followed!)

bc.. DirectoryIndex myhome.htm index.htm index.php

Block Users from accessing the site

bc..
order deny,allow
deny from 202.54.122.33
deny from 8.70.44.53
deny from .spammers.com
allow from all

Allow only LAN users

bc.. order deny,allow
deny from all
allow from 192.168.0.0/24

Redirect Visitors to New Page/Directory

bc.. Redirect oldpage.html http://www.domainname.com/newpage.html
Redirect /olddir http://www.domainname.com/newdir/

Block site from specific referrers

bc.. RewriteEngine on
RewriteCond %{HTTP_REFERER} site-to-block\.com [NC]
RewriteCond %{HTTP_REFERER} site-to-block-2\.com [NC]
RewriteRule .* – [F]

Block Hot Linking/Bandwidth hogging

bc.. RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ – [F]

Want to show a “Stealing is Bad” message too?

Add this below the Hot Link Blocking code:

bc. RewriteRule \.(gif|jpg)$ http://www.mydomain.com/dontsteal.gif [R,L]

Stop .htaccess (or any other file) from being viewed

bc..
order allow,deny
deny from all

Avoid the 500 Error

bc.. # Avoid 500 error by passing charset
AddDefaultCharset utf-8

Grant CGI Access in a directory

bc.. Options +ExecCGI
AddHandler cgi-script cgi pl

1. To enable all scripts in a directory use the following
2. SetHandler cgi-script

Password Protecting Directories

Use the .htaccess Password Generator and follow the brief instructions!

Change Script Extensions

bc. AddType application/x-httpd-php .gne
gne will now be treated as PHP files! Similarly, x-httpd-cgi for CGI files, etc.

Use MD5 Digests

Performance may take a hit but if thats not a problem, this is a nice option to turn on.

bc. ContentDigest On

The CheckSpelling Directive

From Jens Meiert: CheckSpelling corrects simple spelling errors (for example, if someone forgets a letter or if any character is just wrong). Just add CheckSpelling On to your htaccess file.

The ContentDigest Directive

As the Apache core features documentation says: “This directive enables the generation of Content-MD5 headers as defined in RFC1864 respectively RFC2068. The Content-MD5 header provides an end-to-end message integrity check (MIC) of the entity-body. A proxy or client may check this header for detecting accidental modification of the entity-body in transit.

Note that this can cause performance problems on your server since the message digest is computed on every request (the values are not cached). Content-MD5 is only sent for documents served by the core, and not by any module. For example, SSI documents, output from CGI scripts, and byte range responses do not have this header.”

To turn this on, just add ContentDigest On.

Save Bandwidth

bc.. # Only if you use PHP

php_value zlib.output_compression 16386

Turn off magic_quotes_gpc

bc.. # Only if you use PHP

php_flag magic_quotes_gpc off

Apache Cheat Sheet

Setup a Virtual Domain

NameVirtualHost *
<VirtualHost *>
DocumentRoot /web/example.com/www
ServerName www.example.com
ServerAlias example.com
CustomLog /web/example.com/logs/access.log combined
ErrorLog /web/example.com/logs/error.log
</VirtualHost>

Include another conf file

Include /etc/apache/virtual-hosts/*.conf

Hide apache version info

ServerSignature Off
ServerTokens Prod

Custom 404 Error message

ErrorDocument 404 /404.html

Create a virtual directory (mod_alias)

Alias /common /web/common

Permanent redirect (mod_alias)

Redirect permanent /old http://example.com/new

Create a cgi-bin

ScriptAlias /cgi-bin/ /web/cgi-bin/

Process .cgi scripts

AddHandler cgi-script .cgi

Add a directory index

DirectoryIndex index.cfm index.cfm

Turn off directory browsing

Options -Indexes

Turn on directory browsing

<Location /images>
Options +Indexes
</Location>

Create a new user for basic auth (command line)

htpasswd -c /etc/apacheusers

Apache basic authentication

AuthName “Authentication Required”
AuthType Basic
AuthUserFile /etc/apacheusers
Require valid-user

Only allow access from a specific IP

Order Deny,Allow
Deny from all
Allow from 127.0.0.1

Only allow access from your subnet

Order Deny,Allow
Deny from all
Allow from 176.16.0.0/16

Turn on the rewrite engine (mod_rewrite)

RewriteEngine On

Redirect /news/123 to /news.cfm?id=123

RewriteRule ^/news/([0-9]+)$ /news.cfm?id=$1 [PT,L]

Redirect www.example.com to example.com

RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com$1 [R=301,L]