Skip to content

Instantly share code, notes, and snippets.

View amitchhajer's full-sized avatar

Amit Chhajer amitchhajer

View GitHub Profile
@amitchhajer
amitchhajer / php datetime
Created December 28, 2012 06:25
Validating php date and date time
Validating a date from format yyyy-mm-dd
$date = DateTime::createFromFormat('Y-m-d', $generatedFrom);
if (!($date instanceof DateTime)) {
throw new ValidationError('Not valid start date');
}
Similarly other formats can be validated.
@amitchhajer
amitchhajer / Proxy
Created December 28, 2012 06:20
Tunnelling using ssh
ssh -C2qTnN -D 8080 username@xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx is the ip which allows ssh access) (can change the port from 8080 to as per requirement)
You are connected to the proxy. To use the proxy, go the one of your browser
and change the proxy settings to use SOCKS protocol and localhost (127.0.0.1) with port 8080.
@amitchhajer
amitchhajer / ntpdate
Created December 28, 2012 06:15 — forked from anonymous/ntpdate
There are times when you need to keep the date and time of your system to be correct.
Ntpdate in linux helps you do the same
sudo ntpdate -u ntp.ubuntu.org
ntpdate are installed on most distributions, if not install using apt-get.