Pages

Your Ad Here

This Blog is not to read or go through

because, I have never been such a mess


Search the blog instead

Thursday, December 8, 2011

Python - date


Python Date reference


date(2011,10,1)
date.today()

timedelta(days=1)

Monday, August 29, 2011

REGEX Validation - URL, Email, IP etc...

REGEX Validation for the following types.

  1. URL
  2. IP
  3. E-mail
  4. safetext
  5. date
  6. creditcard
  7. password
  8. English_digitwords
  9. English_daywords
  10. English_monthwords
  11. French_digitwords
  12. German_digitwords
  13. Spanish_digitwords
  14. US_zip
  15. US_phone
  16. US_state
  17. US_ssn

Content copied, but check the site for updates. Some changes might have been made. 


   <name>url</name>
  <pattern><![CDATA[^((((https?|ftps?|gopher|telnet|nntp)://)|(mailto:|news:))(%[0-9A-Fa-f]{2}|[-()_.!~*';/?:@&=+$,A-Za-z0-9])+)([).!';/?:,][[:blank:]])?$]]></pattern>

  <name>IP</name>
  <pattern><![CDATA[^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$]]></pattern>

  <name>e-mail</name>
  <pattern><![CDATA[^[\w\-\+\&\*]+(?:\.[\w\-\_\+\&\*]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$]]></pattern>

  <name>safetext</name>
  <pattern><![CDATA[^[a-zA-Z0-9\s.\-]+$]]></pattern>

  <name>date</name>
  <pattern><![CDATA[^(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$]]></pattern>

  <name>creditcard</name>
  <pattern><![CDATA[^((4\d{3})|(5[1-5]\d{2})|(6011)|(7\d{3}))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$]]></pattern>

  <name>password</name>
  <pattern><![CDATA[^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,8}$]]></pattern>

  <name>English_digitwords</name>
  <pattern><![CDATA[^(zero|one|two|three|four|five|six|seven|eight|nine)$]]></pattern>

  <name>English_daywords</name>
  <pattern><![CDATA[^(Mo|Tu|We|Th|Fr|Sa|Su)$]]></pattern>

  <name>English_monthwords</name>
  <pattern><![CDATA[^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)$]]></pattern>

  <name>French_digitwords</name>
  <pattern><![CDATA[^(z[eé]ro|un|deux|trois|quatre|cinq|six|sept|huit|neuf)$]]></pattern>

  <name>German_digitwords</name>
  <pattern><![CDATA[^(null|eins|zwei|drei|vier|f(ue|ü)nf|sechs|sieben|acht|neun)$]]></pattern>

  <name>Spanish_digitwords</name>
  <pattern><![CDATA[^(cero|uno|dos|tres|cuatro|cinco|seis|siete|ocho|nueve)$]]></pattern>

  <name>US_zip</name>
  <pattern><![CDATA[^\d{5}(-\d{4})?$]]></pattern>

  <name>US_phone</name>
  <pattern><![CDATA[^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$]]></pattern>

  <name>US_state</name>
  <pattern><![CDATA[^(AE|AL|AK|AP|AS|AZ|AR|CA|CO|CT|DE|DC|FM|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MH|MD|MA|MI|MN|MS|MO|MP|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PW|PA|PR|RI|SC|SD|TN|TX|UT|VT|VI|VA|WA|WV|WI|WY)$]]></pattern>

  <name>US_ssn</name>
  <pattern><![CDATA[^\d{3}-\d{2}-\d{4}$]]></pattern>


Monday, August 8, 2011

HD Audio Models


  Model name	Description
  ----------    -----------
ALC880
======
  3stack	3-jack in back and a headphone out
  3stack-digout	3-jack in back, a HP out and a SPDIF out
  5stack	5-jack in back, 2-jack in front
  5stack-digout	5-jack in back, 2-jack in front, a SPDIF out
  6stack	6-jack in back, 2-jack in front
  6stack-digout	6-jack with a SPDIF out
  w810		3-jack
  z71v		3-jack (HP shared SPDIF)
  asus		3-jack (ASUS Mobo)
  asus-w1v	ASUS W1V
  asus-dig	ASUS with SPDIF out
  asus-dig2	ASUS with SPDIF out (using GPIO2)
  uniwill	3-jack
  fujitsu	Fujitsu Laptops (Pi1536)
  F1734		2-jack
  lg		LG laptop (m1 express dual)
  lg-lw		LG LW20/LW25 laptop
  tcl		TCL S700
  clevo		Clevo laptops (m520G, m665n)
  medion	Medion Rim 2150
  test		for testing/debugging purpose, almost all controls can be
		adjusted.  Appearing only when compiled with
		$CONFIG_SND_DEBUG=y
  auto		auto-config reading BIOS (default)

ALC260
======
  hp		HP machines
  hp-3013	HP machines (3013-variant)
  hp-dc7600	HP DC7600
  fujitsu	Fujitsu S7020
  acer		Acer TravelMate
  will		Will laptops (PB V7900)
  replacer	Replacer 672V
  favorit100	Maxdata Favorit 100XS
  basic		fixed pin assignment (old default model)
  test		for testing/debugging purpose, almost all controls can
		adjusted.  Appearing only when compiled with
		$CONFIG_SND_DEBUG=y
  auto		auto-config reading BIOS (default)

ALC262
======
  fujitsu	Fujitsu Laptop
  hp-bpc	HP xw4400/6400/8400/9400 laptops
  hp-bpc-d7000	HP BPC D7000
  hp-tc-t5735	HP Thin Client T5735
  hp-rp5700	HP RP5700
  benq		Benq ED8
  benq-t31	Benq T31
  hippo		Hippo (ATI) with jack detection, Sony UX-90s
  hippo_1	Hippo (Benq) with jack detection
  sony-assamd	Sony ASSAMD
  toshiba-s06	Toshiba S06
  toshiba-rx1	Toshiba RX1
  tyan		Tyan Thunder n6650W (S2915-E)
  ultra		Samsung Q1 Ultra Vista model
  lenovo-3000	Lenovo 3000 y410
  nec		NEC Versa S9100
  basic		fixed pin assignment w/o SPDIF
  auto		auto-config reading BIOS (default)

ALC267/268
==========
  quanta-il1	Quanta IL1 mini-notebook
  3stack	3-stack model
  toshiba	Toshiba A205
  acer		Acer laptops
  acer-dmic	Acer laptops with digital-mic
  acer-aspire	Acer Aspire One
  dell		Dell OEM laptops (Vostro 1200)
  zepto		Zepto laptops
  test		for testing/debugging purpose, almost all controls can
		adjusted.  Appearing only when compiled with
		$CONFIG_SND_DEBUG=y
  auto		auto-config reading BIOS (default)

ALC269
======
  basic		Basic preset
  quanta	Quanta FL1
  laptop-amic	Laptops with analog-mic input
  laptop-dmic	Laptops with digital-mic input
  fujitsu	FSC Amilo
  lifebook	Fujitsu Lifebook S6420
  auto		auto-config reading BIOS (default)

ALC662/663/272
==============
  3stack-dig	3-stack (2-channel) with SPDIF
  3stack-6ch	 3-stack (6-channel)
  3stack-6ch-dig 3-stack (6-channel) with SPDIF
  6stack-dig	 6-stack with SPDIF
  lenovo-101e	 Lenovo laptop
  eeepc-p701	ASUS Eeepc P701
  eeepc-ep20	ASUS Eeepc EP20
  ecs		ECS/Foxconn mobo
  m51va		ASUS M51VA
  g71v		ASUS G71V
  h13		ASUS H13
  g50v		ASUS G50V
  asus-mode1	ASUS
  asus-mode2	ASUS
  asus-mode3	ASUS
  asus-mode4	ASUS
  asus-mode5	ASUS
  asus-mode6	ASUS
  asus-mode7	ASUS
  asus-mode8	ASUS
  dell		Dell with ALC272
  dell-zm1	Dell ZM1 with ALC272
  samsung-nc10	Samsung NC10 mini notebook
  auto		auto-config reading BIOS (default)

ALC680
======
  base		Base model (ASUS NX90)
  auto		auto-config reading BIOS (default)

ALC882/883/885/888/889
======================
  3stack-dig	3-jack with SPDIF I/O
  6stack-dig	6-jack digital with SPDIF I/O
  arima		Arima W820Di1
  targa		Targa T8, MSI-1049 T8
  asus-a7j	ASUS A7J
  asus-a7m	ASUS A7M
  macpro	MacPro support
  mb5		Macbook 5,1
  macmini3	Macmini 3,1
  mba21		Macbook Air 2,1
  mbp3		Macbook Pro rev3
  imac24	iMac 24'' with jack detection
  imac91	iMac 9,1
  w2jc		ASUS W2JC
  3stack-2ch-dig	3-jack with SPDIF I/O (ALC883)
  alc883-6stack-dig	6-jack digital with SPDIF I/O (ALC883)
  3stack-6ch    3-jack 6-channel
  3stack-6ch-dig 3-jack 6-channel with SPDIF I/O
  6stack-dig-demo  6-jack digital for Intel demo board
  acer		Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc)
  acer-aspire	Acer Aspire 9810
  acer-aspire-4930g Acer Aspire 4930G
  acer-aspire-6530g Acer Aspire 6530G
  acer-aspire-7730g Acer Aspire 7730G
  acer-aspire-8930g Acer Aspire 8930G
  medion	Medion Laptops
  targa-dig	Targa/MSI
  targa-2ch-dig	Targa/MSI with 2-channel
  targa-8ch-dig Targa/MSI with 8-channel (MSI GX620)
  laptop-eapd   3-jack with SPDIF I/O and EAPD (Clevo M540JE, M550JE)
  lenovo-101e	Lenovo 101E
  lenovo-nb0763	Lenovo NB0763
  lenovo-ms7195-dig Lenovo MS7195
  lenovo-sky	Lenovo Sky
  haier-w66	Haier W66
  3stack-hp	HP machines with 3stack (Lucknow, Samba boards)
  6stack-dell	Dell machines with 6stack (Inspiron 530)
  mitac		Mitac 8252D
  clevo-m540r	Clevo M540R (6ch + digital)
  clevo-m720	Clevo M720 laptop series
  fujitsu-pi2515 Fujitsu AMILO Pi2515
  fujitsu-xa3530 Fujitsu AMILO XA3530
  3stack-6ch-intel Intel DG33* boards
  intel-alc889a	Intel IbexPeak with ALC889A
  intel-x58	Intel DX58 with ALC889
  asus-p5q	ASUS P5Q-EM boards
  mb31		MacBook 3,1
  sony-vaio-tt  Sony VAIO TT
  auto		auto-config reading BIOS (default)

ALC861/660
==========
  3stack	3-jack
  3stack-dig	3-jack with SPDIF I/O
  6stack-dig	6-jack with SPDIF I/O
  3stack-660	3-jack (for ALC660)
  uniwill-m31	Uniwill M31 laptop
  toshiba	Toshiba laptop support
  asus		Asus laptop support
  asus-laptop	ASUS F2/F3 laptops
  auto		auto-config reading BIOS (default)

ALC861VD/660VD
==============
  3stack	3-jack
  3stack-dig	3-jack with SPDIF OUT
  6stack-dig	6-jack with SPDIF OUT
  3stack-660	3-jack (for ALC660VD)
  3stack-660-digout 3-jack with SPDIF OUT (for ALC660VD)
  lenovo	Lenovo 3000 C200
  dallas	Dallas laptops
  hp		HP TX1000
  asus-v1s	ASUS V1Sn
  auto		auto-config reading BIOS (default)

CMI9880
=======
  minimal	3-jack in back
  min_fp	3-jack in back, 2-jack in front
  full		6-jack in back, 2-jack in front
  full_dig	6-jack in back, 2-jack in front, SPDIF I/O
  allout	5-jack in back, 2-jack in front, SPDIF out
  auto		auto-config reading BIOS (default)

AD1882 / AD1882A
================
  3stack	3-stack mode (default)
  6stack	6-stack mode

AD1884A / AD1883 / AD1984A / AD1984B
====================================
  desktop	3-stack desktop (default)
  laptop	laptop with HP jack sensing
  mobile	mobile devices with HP jack sensing
  thinkpad	Lenovo Thinkpad X300
  touchsmart	HP Touchsmart

AD1884
======
  N/A

AD1981
======
  basic		3-jack (default)
  hp		HP nx6320
  thinkpad	Lenovo Thinkpad T60/X60/Z60
  toshiba	Toshiba U205

AD1983
======
  N/A

AD1984
======
  basic		default configuration
  thinkpad	Lenovo Thinkpad T61/X61
  dell_desktop	Dell T3400

AD1986A
=======
  6stack	6-jack, separate surrounds (default)
  3stack	3-stack, shared surrounds
  laptop	2-channel only (FSC V2060, Samsung M50)
  laptop-eapd	2-channel with EAPD (ASUS A6J)
  laptop-automute 2-channel with EAPD and HP-automute (Lenovo N100)
  ultra		2-channel with EAPD (Samsung Ultra tablet PC)
  samsung	2-channel with EAPD (Samsung R65)
  samsung-p50	2-channel with HP-automute (Samsung P50)

AD1988/AD1988B/AD1989A/AD1989B
==============================
  6stack	6-jack
  6stack-dig	ditto with SPDIF
  3stack	3-jack
  3stack-dig	ditto with SPDIF
  laptop	3-jack with hp-jack automute
  laptop-dig	ditto with SPDIF
  auto		auto-config reading BIOS (default)

Conexant 5045
=============
  laptop-hpsense    Laptop with HP sense (old model laptop)
  laptop-micsense   Laptop with Mic sense (old model fujitsu)
  laptop-hpmicsense Laptop with HP and Mic senses
  benq		Benq R55E
  laptop-hp530	HP 530 laptop
  test		for testing/debugging purpose, almost all controls
		can be adjusted.  Appearing only when compiled with
		$CONFIG_SND_DEBUG=y

Conexant 5047
=============
  laptop	Basic Laptop config 
  laptop-hp	Laptop config for some HP models (subdevice 30A5)
  laptop-eapd	Laptop config with EAPD support
  test		for testing/debugging purpose, almost all controls
		can be adjusted.  Appearing only when compiled with
		$CONFIG_SND_DEBUG=y

Conexant 5051
=============
  laptop	Basic Laptop config (default)
  hp		HP Spartan laptop
  hp-dv6736	HP dv6736
  hp-f700	HP Compaq Presario F700
  ideapad	Lenovo IdeaPad laptop
  lenovo-x200	Lenovo X200 laptop
  toshiba	Toshiba Satellite M300

Conexant 5066
=============
  laptop	Basic Laptop config (default)
  hp-laptop	HP laptops, e g G60
  asus		Asus K52JU, Lenovo G560
  dell-laptop	Dell laptops
  dell-vostro	Dell Vostro
  olpc-xo-1_5	OLPC XO 1.5
  ideapad       Lenovo IdeaPad U150
  thinkpad	Lenovo Thinkpad

STAC9200
========
  ref		Reference board
  oqo		OQO Model 2
  dell-d21	Dell (unknown)
  dell-d22	Dell (unknown)
  dell-d23	Dell (unknown)
  dell-m21	Dell Inspiron 630m, Dell Inspiron 640m
  dell-m22	Dell Latitude D620, Dell Latitude D820
  dell-m23	Dell XPS M1710, Dell Precision M90
  dell-m24	Dell Latitude 120L
  dell-m25	Dell Inspiron E1505n
  dell-m26	Dell Inspiron 1501
  dell-m27	Dell Inspiron E1705/9400
  gateway-m4	Gateway laptops with EAPD control
  gateway-m4-2	Gateway laptops with EAPD control
  panasonic	Panasonic CF-74
  auto		BIOS setup (default)

STAC9205/9254
=============
  ref		Reference board
  dell-m42	Dell (unknown)
  dell-m43	Dell Precision
  dell-m44	Dell Inspiron
  eapd		Keep EAPD on (e.g. Gateway T1616)
  auto		BIOS setup (default)

STAC9220/9221
=============
  ref		Reference board
  3stack	D945 3stack
  5stack	D945 5stack + SPDIF
  intel-mac-v1	Intel Mac Type 1
  intel-mac-v2	Intel Mac Type 2
  intel-mac-v3	Intel Mac Type 3
  intel-mac-v4	Intel Mac Type 4
  intel-mac-v5	Intel Mac Type 5
  intel-mac-auto Intel Mac (detect type according to subsystem id)
  macmini	Intel Mac Mini (equivalent with type 3)
  macbook	Intel Mac Book (eq. type 5)
  macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3)
  macbook-pro	Intel Mac Book Pro 2nd generation (eq. type 3)
  imac-intel	Intel iMac (eq. type 2)
  imac-intel-20	Intel iMac (newer version) (eq. type 3)
  ecs202	ECS/PC chips
  dell-d81	Dell (unknown)
  dell-d82	Dell (unknown)
  dell-m81	Dell (unknown)
  dell-m82	Dell XPS M1210
  auto		BIOS setup (default)

STAC9202/9250/9251
==================
  ref		Reference board, base config
  m1		Some Gateway MX series laptops (NX560XL)
  m1-2		Some Gateway MX series laptops (MX6453)
  m2		Some Gateway MX series laptops (M255)
  m2-2		Some Gateway MX series laptops
  m3		Some Gateway MX series laptops
  m5		Some Gateway MX series laptops (MP6954)
  m6		Some Gateway NX series laptops
  auto		BIOS setup (default)

STAC9227/9228/9229/927x
=======================
  ref		Reference board
  ref-no-jd	Reference board without HP/Mic jack detection
  3stack	D965 3stack
  5stack	D965 5stack + SPDIF
  5stack-no-fp	D965 5stack without front panel
  dell-3stack	Dell Dimension E520
  dell-bios	Fixes with Dell BIOS setup
  volknob	Fixes with volume-knob widget 0x24
  auto		BIOS setup (default)

STAC92HD71B*
============
  ref		Reference board
  dell-m4-1	Dell desktops
  dell-m4-2	Dell desktops
  dell-m4-3	Dell desktops
  hp-m4		HP mini 1000
  hp-dv5	HP dv series
  hp-hdx	HP HDX series
  hp-dv4-1222nr	HP dv4-1222nr (with LED support)
  auto		BIOS setup (default)

STAC92HD73*
===========
  ref		Reference board
  no-jd		BIOS setup but without jack-detection
  intel		Intel DG45* mobos
  dell-m6-amic	Dell desktops/laptops with analog mics
  dell-m6-dmic	Dell desktops/laptops with digital mics
  dell-m6	Dell desktops/laptops with both type of mics
  dell-eq	Dell desktops/laptops
  alienware	Alienware M17x
  auto		BIOS setup (default)

STAC92HD83*
===========
  ref		Reference board
  mic-ref	Reference board with power management for ports
  dell-s14	Dell laptop
  hp		HP laptops with (inverted) mute-LED
  hp-dv7-4000	HP dv-7 4000
  auto		BIOS setup (default)

STAC9872
========
  vaio		VAIO laptop without SPDIF
  auto		BIOS setup (default)

Cirrus Logic CS4206/4207
========================
  mbp55		MacBook Pro 5,5
  imac27	IMac 27 Inch
  auto		BIOS setup (default)

VIA VT17xx/VT18xx/VT20xx
========================
  auto		BIOS setup (default)

Tuesday, July 19, 2011

How to set up your private GIT Server

Source: http://tumblr.intranation.com/post/766290565/how-set-up-your-own-private-git-server-linux


How to set up your own private Git server on Linux

Update 2: as pointed out by Tim Huegdon, several comments on a Hacker News thread pointing here, and the excellent Pro Git book, Gitolite seems to be a better solution for multi-user hosted Git than Gitosis. I particularly like the branch–level permissions aspect, and what that means for business teams. I’ve left the original article intact.
Update: the ever–vigilant Mike West has pointed out that my instructions for permissions and git checkout were slightly askew. These errors have been rectified.
One of the things I’m attempting to achieve this year is simplifying my life somewhat. Given how much of my life revolves around technology, a large part of this will be consolidating the various services I consume (and often pay for). The mention of payment is important, as up until now I’ve been paying the awesome GitHub for their basic plan.
I don’t have many private repositories with them, and all of them are strictly private code (this blog; Amanda’s blog templates and styles; and some other bits) which don’t require collaborators. For this reason, paying money to GitHub (awesome though they may be) seemed wasteful.
So I decided to move all my private repositories to my own server. This is how I did it.

Set up the server

These instructions were performed on a Debian 5 “Lenny” box, so assume them to be the same on Ubuntu. Substitute the package installation commands as required if you’re on an alternative distribution.
First, if you haven’t done so already, add your public key to the server:
ssh myuser@server.com mkdir .ssh
scp ~/.ssh/id_rsa.pub myuser@server.com:.ssh/authorized_keys
Now we can SSH into our server and install Git:
ssh myserver.com
sudo apt-get update
sudo apt-get install git-core
…and that’s it.

Adding a user

If you intend to share these repositories with any collaborators, at this point you’ll either:
We’ll be following the latter option. So, add a Git user:
sudo adduser git
Now you’ll need to add your public key to the Git user’s authorized_keys:
sudo mkdir /home/git/.ssh
sudo cp ~/.ssh/authorized_keys /home/git/.ssh/
sudo chown -R git:git /home/git/.ssh
sudo chmod 700 !$
sudo chmod 600 /home/git/.ssh/*
Now you’ll be able to authenticate as the Git user via SSH. Test it out:
ssh git@myserver.com

Add your repositories

If you were to not share the repositories, and just wanted to access them for yourself (like I did, since I have no collaborators), you’d do the following as yourself. Otherwise, do it as the Git user we added above.
If using the Git user, log in as them:
login git
Now we can create our repositories:
mkdir myrepo.git
cd !$
git --bare init
The last steps creates an empty repository. We’re assuming you already have a local repository that you just want to push to a remote server.
Repeat that last step for each remote Git repository you want.
Log out of the server as the remaining operations will be completed on your local machine.

Configure your development machine

First, we add the remotes to your local machine. If you’ve already defined a remote named origin(for example, if you followed GitHub’s instructions), you’ll want to delete the remote first:
git remote rm origin
Now we can add our new remote:
git remote add origin git@server.com:myrepo.git
git push origin master
And that’s it. You’ll probably also want to make sure you add a default merge and remote:
git config branch.master.remote origin && git config branch.master.merge refs/heads/master
And that’s all. Now you can push/pull from origin as much as you like, and it’ll be stored remotely on your own myserver.com remote repository.

Bonus points: Make SSH more secure

This has been extensively covered by the excellent Slicehost tutorial, but just to recap:
Edit the SSH config:
sudo vi /etc/ssh/sshd_config
And change the following values:
Port 2207
...
PermitRootLogin no
...
AllowUsers myuser git
...
PasswordAuthentication no
Where 2207 is a port of your choosing. Make sure to add this so your Git remote:
git remote add origin ssh://git@myserver.com:2207/~/myrepo.git


--------------------


Sunday, July 3, 2011

MYSQL Levenshtein Algorithm

Google +1 Button in your site

Implement +1 button to your website

The implementation button is simple. You just need to insert two line of codes to your HTML or theme file.
1. Insert the following javascript code to your  tag
<script type="text/javascript" src="http://apis.google.com/js/plusone.js">script>
2. Insert the following tag to the place where you want the button to appear.
That ‘s it.
For WordPress
As of this post, there are no plugins for adding the +1 button yet (but I am sure it will be available very soon). To add the +1 button, in your themes folder, open the header.php file. Insert the javascript code to the  tag
Open your single.php or index.php, and place the  to the place where you want it to appear.
plus1-button-code

Parameter

There are several parameters that you can use.
Size of the button: The default is “standard“, which is 24px tall. You can choose “small” (15px), “medium” (20px) or “tall” (60px).
Include count: The default is set to “true”. You can turn it off if you don’t want the +1′d count to appear.
URL (href): By default, the button will grab the URL of the existing page, but you can specify your own URL with the parameter href="your-url-here".

http://maketecheasier.com/add-google-1-to-website/2011/06/02
Source: 

Thursday, June 23, 2011

Disabling / Enabling Keyboard and Mouse in Linux (Xinput)

http://wpkg.org/Disable_/_enable_keyboard_and_mouse_in_Linux


Here is how to do it:
  • First, list the devices your X sees:
$ xinput --list
"Virtual core pointer"  id=0    [XPointer]
"Virtual core keyboard" id=1    [XKeyboard]
"Keyboard2"     id=2    [XExtensionKeyboard]
"Mouse2"        id=3    [XExtensionKeyboard]

  • Now, list details for the mouse (id=3):
$ xinput --list-props 3
Device 'Mouse2':
        Device Enabled (119):   1
        Evdev Reopen Attempts (254):    10
        Evdev Axis Inversion (257):     0, 0
        Evdev Axis Calibration (258):   
        Evdev Axes Swap (259):  0
        Evdev Middle Button Emulation (260):    2
        Evdev Middle Button Timeout (261):      50
        Evdev Wheel Emulation (262):    0
        Evdev Wheel Emulation Axes (263):       0, 0, 4, 5
        Evdev Wheel Emulation Inertia (264):    10
        Evdev Wheel Emulation Timeout (265):    200
        Evdev Wheel Emulation Button (266):     4
        Evdev Drag Lock Buttons (267):  0

  • Disable the mouse:
$ export DISPLAY=:0
$ xinput set-int-prop 3 "Device Enabled" 8 0

  • Enable the mouse again:
$ xinput set-int-prop 3 "Device Enabled" 8 1

  • Disable the keyboard:
$ xinput set-int-prop 2 "Device Enabled" 8 0

  • Enable the keyboard again:
$ xinput set-int-prop 2 "Device Enabled" 8 1

  • You may find more details in "man xinput".

Wednesday, May 25, 2011

SSH Socks Proxy


$ssh -D 9999 username@ip-address-of-ssh-server


Listens to Port 9999 and tunnels the connection via the ssh-server connected

Tuesday, May 17, 2011

base_url() function for php



function base_url(){
    $pathinfo = pathinfo($_SERVER["SCRIPT_NAME"]);
    $dirname = $pathinfo["dirname"];
    if($_SERVER["HTTPS"] == "on"){
    $protocol = "https";
    }else{
        $protocol = "http";
    }
    $base_url = $protocol."://".$_SERVER["HTTP_HOST"].$dirname."/";
    return $base_url;
}

Thursday, May 12, 2011

Thursday, January 6, 2011

Adding network printer in linux

$ lpadmin -p some-printer-name -E -v ipp://network-ip-address/printers/printer-name

forexample
$ lpadmin -p LBP3050_on_server -E -v ipp://192.168.144.1/printers/LBP3050

Local printer alias - LBP3050_on_server
Server 192.168.144.1
Server Printer - LBP3050
Your Ad Here