Copyright © 2010 Lockstockmods. All Rights Reserved. Snowblind by Themes by bavotasan.com. Powered by WordPress.
Author Archive
This post is password protected. To view it please enter your password below:
Password:
This post is password protected. To view it please enter your password below:
Password:
The purpose of this guide is to provide an easy to follow set of instructions that should allow you to create an SSH tunnel in around 10 minutes.
Step 1: Getting started
What you will need:
- Remote server running SSH (Debian server is used in this guide)
- Putty
- Squid
Install squid:
apt-get install squid
Step 2: Configure putty
- Start putty
- From left hand tree menu select Click SSH (under the Connection menu item) to expand the tree items, then click on Tunnels
- In Source port enter 3128 (default Squid port), select Dynamic and click on the Add button
- In the left hand menu go to Session
- Put the hostname of your server, select SSH (if not already selected), then under Saved Sessions type tunnel (or any name you want to call the saved session) and click save. This will enable you, in the future to click on “tunnel”, click Load, then Open.
- Click Open. You cannot SSH tunnel without an open connection, it will ask you for your username and password.
Step 3: Configure Firefox
- Click Tools, then select Options…
- Select the Advanced option then then Network tab.
- Click on Settings
- Select Manual proxy configuration, then under SOCKS Host type localhost and in Port enter 3128 (In Vista SP1 you might have to use 127.0.0.1 instead of localhost for the SOCKS Host)
Congratulations, you should now have a fully functioning SSH Tunnel, you can test this by going to Whats My IP
Continue Reading »
This guide provides an easy and relatively quick way to PXE boot windows which means you can install Windows over the network with PXE without the need for a CD drive. While the previous guide allows you to slip stream updates and add extra programs it took a LONG LONG time to do, especially with all the downloads it needed to do, this one just installs a vanilla XP, nice and simple, and a lot quicker ![]()
Step 1: Getting started.
What you’ll need:
Once you’ve collected all of the above, lets begin;
Background
Backgrounds can be tricky. Nevertheless, effective when condensed correctly. The syntax for declaring the background shorthand values are as follows:
background properties
element {
background-color: color || #hex || (rgb / % || 0-255);
background-image:url(URI);
background-repeat: repeat || repeat-x || repeat-y || no-repeat;
background-position: X Y || (top||bottom||center) (left||right||center);
background-attachment: scroll || fixed;
}
Believe it or not, all these properties can be combined into one single background property as follows:
the background shorthand property
element {
background:
#fff
url(image.png)
no-repeat
20px 100px
fixed;
}
The Unknown
Often times developers find themselves wondering What if I leave out this value or that one? How will that effect the design?. Good questions.
By default, the background property will assume the following when you do not declare each value of the properties.
default background property values
element {
background-color: transparent;
background-image: none;
background-repeat: repeat;
background-position: top left;
background-attachment: scroll;
}
Lesson learned: be careful on what you don’t declare. By chosing to not declare a value on a shorthand property, you are explicitly declaring the above default settings. For example, let’s look at the following example.
background shorthand example (unexplicit)
element {
background:red url(image.png);
}
This would be the same as declaring the following values:
background shorthand example (explicit)
element {
background:red url(image.png) repeat top left scroll;
}
Font
Font is perhaps the trickiest. However, it follows the same rules as the background shorthand property. All that you do not declare will have unexplicit values. Here is the font shorthand specification:
font properties
element {
font-style: normal || italic || oblique;
font-variant:normal || small-caps;
font-weight: normal || bold || bolder || || lighter || (100-900);
font-size: (number+unit) || (xx-small – xx-large);
line-height: normal || (number+unit);
font-family:name,”more names”;
}
The default values for the font shorthand property are as follows:
default font property values
element {
font-style: normal;
font-variant:normal;
font-weight: normal;
font-size: inherit;
line-height: normal;
font-family:inherit;
}
And of course without any further ado. The font shorthand property syntax:
the font shorthand property
element {
font:
normal
normal
normal
inhert/
normal
inherit;
}
Here is where it gets tricky. The fact that font-style, font-variant, and font-weight all come “normal” out of the box, you may need to pay a little more close attention when you’re styling elements that come with default browser styles like <h1> – <h6> or <strong> and <em>. For example, styling the strong element:
strong element styled with font
strong {
font:12px verdana;
}
By writing the above into your style sheet, you will be unexplicitly removing the font-weight:bold default browser style that is applied to strong elements.
Last but not least (for -font- that is), a real world example:
font shorthand property example (unexplicit)
p {
font:bold 1em/1.2em georgia,”times new roman”,serif;
}
This would be the same as declaring the following properties:
the font shorthand property (explicit)
p {
font-style:normal;
font-variant:normal;
font-weight:bold;
font-size:1em;
line-height:1.2em;
font-family:georgia,”times new roman”,serif;
}
Border
Let’s not waste time discussing the warnings. The same rules apply from here on out. This is all you need to know
border properties
element {
border-width: number+unit;
border-style: (numerous);
border-color: color || #hex || (rgb / % || 0-255);
}
becomes this:
the border shorthand propertie
element {
border:
4px
groove
linen
}
Don’t ask me how that would look. The fact that “linen” is in there, things could get scary. Nevermind the matter, here is where ‘border’ gets funny.
border examples
p {
border:solid blue;
}
/* will create a ‘3px’ solid blue border…
who knows where 3px came from?? */
p {
border:5px solid;
}
/* will create 5px solid ‘black’ border…
default must be black?? */
p {
border:dashed;
}
/* will create a ‘3px’ dashed ‘black’ border…
3px black lines unite! */
p { border:10px red; }
p { border:10px; }
p { border:red; }
/* these just don’t even work */
One thing to specially take note about declaring a border without a color, the default will be ‘black’ unless otherwise noted through an explicit or inherited ‘color’ property. See the following examples:
border color examples
p {
border:dotted;
color:red;
}
/* will create a 3px dotted red border */
/* —————————– */
body {
color:blue;
}
body p {
border:5px solid;
}
/* will create a 5px solid blue border */
/* —————————– */
Get it? Got it. Good! (isn’t that a song?) Anyway. On with this
Margin and Padding
These are by far the easiest. Just think about the hands of a clock starting at noon, and follow the hour. For the sake of brevity, we’ll be working with margin (since it’s a shorter word). So for all cases of margin, the same rules apply to padding.
margin properties.
element {
margin-top: number+unit;
margin-right: number+unit;
margin-bottom: number+unit;
margin-left: number+unit;
}
… combined into the margin superpowers:
the margin shorthand property
/* top right bottom left */
element {
margin: auto auto auto auto;
}
Of course, you may declare your margin with one, two, three, or four values. Here is how each scenario will be played out:
margin fun
/* adds a 10px margin to all four sides */
element {
margin:10px;
}
/* adds a 20px margin to top and bottom
and a 5px margin to left and right */
element {
margin:20px 5px;
}
/* adds a 50px margin to top
and a 10px margin to left and right
and a 300px margin to bottom */
element {
margin:50px 10px 300px;
}
Understood? Let’s keep going. This is fun isn’t it! (whatever, you like it).
Outline
Quite frankly, this property has dropped off the existence of the design radar. Mainly because of lack of browsers supporting this CSS 2.1 standard (yep, it’s an actual property), but nonetheless, it too has a shorthand property. This property follows the exact same (or same exact – they mean the same thing) specification as the ‘border’ shorthand property. But, for purposes of this being a Guide, it must be here. So:
outline properties
element {
outline-width: number+unit;
outline-style: (numerous);
outline-color: color || #hex || (rgb / % || 0-255);
}
Outline written as shorthand:
outline shorthand property
element {
outline:3px dotted gray;
}
For purposes of trying to keep things from repeating, please see the border shorthand section on this document to understand the odds, ends, and quirks of the outline property.
List-style
This is it. The last one. It’s rarely used frequently. Hence rarely. That is why I kept it until the end (sorry, the best was first in my own opinion). Here is the list-style properties:
list-style properties
element {
list-style-type: (numerous);
list-style-position:inside || outside;
list-style-image:url(image.png);
}
Here is the defaults:
list-style property defaults
element {
list-style-type:disc;
list-style-position:outside;
list-style-image:none;
}
And for the sake of final brevity. Here is a simple example:
list-style shorthand property example
ul li {
list-style:square inside url(image.png);
}
/* in this particular case if image.png is not available
then a square will be provided as secondary */
This guide is originally from http://www.dustindiaz.com/css-shorthand/
Query
SELECT * FROM table
SELECT * FROM table1, table2, …
SELECT field1, field2, … FROM table1, table2, …
SELECT … FROM … WHERE condition
SELECT … FROM … WHERE condition GROUPBY field
SELECT … FROM … WHERE condition GROUPBY field HAVING condition2
SELECT … FROM … WHERE condition ORDER BY field1, field2
SELECT … FROM … WHERE condition ORDER BY field1, field2 DESC
SELECT … FROM … WHERE condition LIMIT 10
SELECT DISTINCT field1 FROM …
SELECT DISTINCT field1, field2 FROM …
SELECT … FROM t1 JOIN t2 ON t1.id1 = t2.id2 WHERE condition
SELECT … FROM t1 LEFT JOIN t2 ON t1.id1 = t2.id2 WHERE condition
SELECT … FROM t1 JOIN (t2 JOIN t3 ON …) ON …
conditionals:
field1 = value1
field1 <> value1
field1 LIKE ‘value _ %’
field1 IS NULL
field1 IS NOT NULL
field1 IS IN (value1, value2)
field1 IS NOT IN (value1, value2)
condition1 AND condition2
condition1 OR condition2
Data Manipulation
INSERT INTO table1 (field1, field2, …) VALUES (value1, value2, …)
DELETE FROM table1 / TRUNCATE table1
DELETE FROM table1 WHERE condition
– join:
DELETE FROM table1, table2 FROM table1, table2 WHERE table1.id1 = table2.id2 AND condition
UPDATE table1 SET field1=new_value1 WHERE condition
– join:
UPDATE table1, table2 SET field1=new_value1, field2=new_value2, … WHERE table1.id1 = table2.id2 AND condition
Browsing
SHOW DATABASES
SHOW TABLES
SHOW FIELDS FROM table / DESCRIBE table
SHOW CREATE TABLE table
SHOW PROCESSLIST
KILL process_number
Create / delete database
CREATE DATABASE mabase
CREATE DATABASE mabase CHARACTER SET utf8
DROP DATABASE mabase
ALTER DATABASE mabase CHARACTER SET utf8
Create/delete/modify table
CREATE TABLE table (field1 type1, field2 type2, …)
CREATE TABLE table (field1 type1, field2 type2, …, INDEX (field))
CREATE TABLE table (field1 type1, field2 type2, …, PRIMARY KEY (field1))
CREATE TABLE table (field1 type1, field2 type2, …, PRIMARY KEY (field1, field2))
CREATE TABLE table1 (fk_field1 type1, field2 type2, …,
FOREIGN KEY (fk_field1) REFERENCES table2 (t2_fieldA))
CREATE TABLE table1 (fk_field1 type1, fk_field2 type2, …,
FOREIGN KEY (fk_field1, fk_field2) REFERENCES table2 (t2_fieldA, t2_fieldB))
CREATE TABLE table IF NOT EXISTS (…)
CREATE TEMPORARY TABLE table (…)
DROP TABLE table
DROP TABLE IF EXISTS table
DROP TABLE table1, table2, …
ALTER TABLE table MODIFY field1 type1
ALTER TABLE table MODIFY field1 type1 NOT NULL …
ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1
ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1 NOT NULL …
ALTER TABLE table ALTER field1 SET DEFAULT …
ALTER TABLE table ALTER field1 DROP DEFAULT
ALTER TABLE table ADD new_name_field1 type1
ALTER TABLE table ADD new_name_field1 type1 FIRST
ALTER TABLE table ADD new_name_field1 type1 AFTER another_field
ALTER TABLE table DROP field1
ALTER TABLE table ADD INDEX (field);
– Change field order:
ALTER TABLE table MODIFY field1 type1 FIRST
ALTER TABLE table MODIFY field1 type1 AFTER another_field
ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1 FIRST
ALTER TABLE table CHANGE old_name_field1 new_name_field1 type1 AFTER another_field
ALTER TABLE old_name RENAME new_name;
Keys
CREATE TABLE table (…, PRIMARY KEY (field1, field2))
CREATE TABLE table (…, FOREIGN KEY (field1, field2) REFERENCES table2 (t2_field1, t2_field2))
Privileges
GRANT ALL PRIVILEGES ON base.* TO ‘user’@'localhost’ IDENTIFIED BY ‘password’;
GRANT SELECT, INSERT, DELETE ON base.* TO ‘user’@'localhost’ IDENTIFIED BY ‘password’;
REVOKE ALL PRIVILEGES ON base.* FROM ‘user’@'host’; — one permission only
REVOKE ALL PRIVILEGES, GRANT OPTION FROM ‘user’@'host’; — all permissions
SET PASSWORD = PASSWORD(’new_pass’)
SET PASSWORD FOR ‘user’@'host’ = PASSWORD(’new_pass’)
SET PASSWORD = OLD_PASSWORD(’new_pass’)
DROP USER ‘user’@'host’
Main data types
TINYINT (1o: -217+128) SMALLINT (2o: +-65 000)
MEDIUMINT (3o: +-16 000 000) INT (4o: +- 2 000 000 000)
BIGINT (8o: +-9.10^18)
Precise interval: -(2^(8*N-1)) -> (2^8*N)-1
/!\ INT(2) = “2 digits displayed” — NOT “number with 2 digits max”
FLOAT(M,D) DOUBLE(M,D) FLOAT(D=0->53)
/!\ 8,3 -> 12345,678 — NOT 12345678,123!
TIME (HH:MM) YEAR (AAAA) DATE (AAAA-MM-JJ) DATETIME (AAAA-MM-JJ HH:MM; années 1000->9999)
TIMESTAMP (like DATETIME, but 1970->2038, compatible with Unix)
VARCHAR (single-line; explicit size) TEXT (multi-lines; max size=65535) BLOB (binary; max size=65535)
Variants for TEXT&BLOB: TINY (max=255) MEDIUM (max=~16000) LONG (max=4Go)
Ex: VARCHAR(32), TINYTEXT, LONGBLOB, MEDIUMTEXT
ENUM (’value1′, ‘value2′, …) — (default NULL, or ” if NOT NULL)
Forgot root password?
$ /etc/init.d/mysql stop
$ mysqld_safe –skip-grant-tables
$ mysql # on another terminal
mysql> UPDATE mysql.user SET password=PASSWORD(’nouveau’) WHERE user=’root’;
## Kill mysqld_safe from the terminal, using Control + \
$ /etc/init.d/mysql start
Repair tables after unclean shutdown
mysqlcheck –all-databases
mysqlcheck –all-databases –fast
You may have read in a previous post how i installed Ubuntu on my sisters laptop with PXE, well this worked great, but i couldnt for the life of me get WPA to work on the wireless card, so after about a week of trying i decided to try and PXE boot windows as the laptop had no floppy drive, no CD drive and couldnt boot from USB, what follows is the result of the trials and tribulations of that experience…. enjoy. If you want a quicker, simpler installation with a vanilla XP check this Easy way to PXE Boot Windows guide.
Downloads
Step 1: Getting started.
What you’ll need:
Once you’ve collected all of the above, do the below:
Downloading necessary sources using the DVD Generator.
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
Perminant 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
From http://www.petefreitag.com/cheatsheets/apache/
Here is a simple cheatsheet for the .htaccess file:
Enable Directory Browsing
Options +Indexes
## block a few types of files from showing
IndexIgnore *.wmv *.mp4 *.avi
Disable Directory Browsing
Options All -Indexes
ErrorDocument 403 http://www.htaccesselite.com
Order deny,allow
Deny from all
Allow from 1.1.1.1
Redirect all but 1 IP to different site, using mod_rewrite
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^1\.1\.1\.1
RewriteRule .* http://www.htaccesselite.com
Redirect Everyone but you to alternate page on your server.
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^1\.1\.1\.1
RewriteCond %{REQUEST_URI} !/temporary-offline\.html$
RewriteRule .* /temporary-offline.html
Customize Error Messages
ErrorDocument 403 /forbidden.html
ErrorDocument 404 /notfound.html
ErrorDocument 500 /servererror.html
Get SSI working with HTML/SHTML
AddType text/html .html
AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml
# AddHandler server-parsed .htm
Change Default Page (order is followed!)
DirectoryIndex myhome.htm index.htm index.php
Block Users from accessing the site
<limit GET POST PUT>
order deny,allow
deny from 202.54.122.33
deny from 8.70.44.53
deny from .spammers.com
allow from all
</limit>
Allow only LAN users
order deny,allow
deny from all
allow from 192.168.0.0/24
Redirect Visitors to New Page/Directory
Redirect oldpage.html http://www.domainname.com/newpage.html
Redirect /olddir http://www.domainname.com/newdir/
Block site from specific referrers
RewriteEngine on
RewriteCond %{HTTP_REFERER} site-to-block\.com
RewriteCond %{HTTP_REFERER} site-to-block-2\.com
RewriteRule .* –
Block Hot Linking/Bandwidth hogging
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$
RewriteRule \.(gif|jpg)$ –
Want to show a “Stealing is Bad” message too?
Add this below the Hot Link Blocking code:
RewriteRule \.(gif|jpg)$ http://www.mydomain.com/dontsteal.gif
Stop .htaccess (or any other file) from being viewed
<files file-name>
order allow,deny
deny from all
</files>
Avoid the 500 Error
# Avoid 500 error by passing charset
AddDefaultCharset utf-8
Grant CGI Access in a directory
Options +ExecCGI
AddHandler cgi-script cgi pl
# To enable all scripts in a directory use the following
# SetHandler cgi-script
Password Protecting Directories
Use the .htaccess Password Generator and follow the brief instructions!
Change Script Extensions
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.
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
# Only if you use PHP
<ifmodule mod_php4.c>
php_value zlib.output_compression 16386
</ifmodule>
Turn off magic_quotes_gpc
# Only if you use PHP
<ifmodule mod_php4.c>
php_flag magic_quotes_gpc off
</ifmodule>
Taken from http://www.thejackol.com/htaccess-cheatsheet/
Regex Character Definitions for htaccess
#the # instructs the server to ignore the line. used for including comments. each line of comments requires it’s own #. when including comments, it is good practice to use only letters, numbers, dashes, and underscores. this practice will help eliminate/avoid potential server parsing errors.+defines any number of characters which contains neither slash nor dot.http://this is a literal statement — in this case, the literal character string, “http://”.^domain.*defines a string that begins with the term “domain”, which then may be proceeded by any number of any characters.^domain\.com$defines the exact string “domain.com”.-dtests if string is an existing directory-ftests if string is an existing file-stests if file in test string has a non-zero valueThe Options directive controls which server features are available in a particular directory.
option can be set to None, in which case none of the extra features are enabled, or one or more of the following:
All
All options except for MultiViews. This is the default setting.
ExecCGI
Execution of CGI scripts is permitted.
FollowSymLinks
The server will follow symbolic links in this directory.
Note: even though the server follows the symlink it does not change the pathname used to match against <Directory> sections.
Note: this option gets ignored if set inside a <Location> section.
Includes
Server-side includes are permitted.
IncludesNOEXEC
Server-side includes are permitted, but the #exec command and #exec CGI are disabled. It is still possible to #include virtual CGI scripts from ScriptAliase’d directories.
Indexes
If a URL which maps to a directory is requested, and the there is no DirectoryIndex (e.g., index.html) in that directory, then the server will return a formatted listing of the directory.
MultiViews
Content negotiated MultiViews are allowed.
SymLinksIfOwnerMatch
The server will only follow symbolic links for which the target file or directory is owned by the same user id as the link.
Note: this option gets ignored if set inside a <Location> section.
Purpose
This tutorial will attempt to help you get to grips with using Usenet, including signing up to a usenet provider, searching usenet, and downloading binary files with step by step instructions.
Introduction
The biggest problem with the music and movie industry is that they produce crap, nobody wants to spend their hard earned money buying crap, so they will download it first, if they like it they buy it, if they dont they wont, of course, not all users will buy what they like, but if they couldnt download it chances are they still wouldnt buy it.
Its up to industry to change their business model, in order to keep up with the modern age, but instead they blame the pirates, they spread their lies “Downloading music and films is STEALING” … uhm.. no it isnt, its copyright infringement, if i steal your car, you havent got a car, if i make a copy of your film, you still have the film.
The more people hear the propaganda, the more they believe it, and EVEN start agreeing with it, its ludicrous. Then you have Government officials that make stupid decisions, to panda to industry, like telling ISP’s they have to monitor all their users, not only unworkable, but potentially very dangerous.
None of this takes into account Fair Use, if i buy a film i want to be able to watch it how i like, my DVDs get scratched, so i download a copy thats not going to get damaged, because it takes several hours to rip the DVD, but only 20 minutes to download it.
So in these increasingly hostile times Usenet seems the only way to go, it offers speed, reliability, and the option of SSL, sure, it costs money, but its not that expensive, and in my mind its worth every penny, i would personally recommend Giganews they have the worlds longest usenet binary retention, multiple gigabit-plus backbones running at a fraction of capacity, and the option of 256-bit SSL encryption among other things.
Getting started
Usenet is a little more difficult to use than torrents, so here is some information to help you.
First thing you need to do is register with a usenet provider, i personally use Giganews but there are plenty to choose from.
Second you will need a way to search usenet for this you can use, newzbin is probably the easiest and arguably the best, but its got closed registration at the moment, and you have to pay for it.
Thirdly you will need a binary client, i use http://www.newsleecher.com/ there are plenty out there, but i havent found another one as fully featured and useable as this, however, you need to pay for this one as well.
Set up the server settings with the details you get from your provider
Continue Reading »

Recent Comments