Skip to content

Instantly share code, notes, and snippets.

View mohitesachin217's full-sized avatar
🎯
Focusing

mohitesachin217 mohitesachin217

🎯
Focusing
View GitHub Profile
@mohitesachin217
mohitesachin217 / new_gist_file_0
Last active August 16, 2016 12:35
get age from date of birth javascript code
function getAge(birth) {
ageMS = Date.parse(Date()) - Date.parse(birth);
age = new Date();
age.setTime(ageMS);
ageYear = age.getFullYear() - 1970;
return ageYear;
}
@mohitesachin217
mohitesachin217 / wordpress-ftp-on-localhost
Created June 20, 2016 02:23
wordpress ftp credentials requirement on localhost override
define('FS_METHOD', 'direct');
add this line to stop wordpress asking for ftp while installing on localhost
@mohitesachin217
mohitesachin217 / owner-permission
Last active June 19, 2016 14:37
managing file ownership and permissions for linux
ownershop
-- chmod / chgrp
permission
-- files & folder
-- chmod
-- octal
-- umask
special permissons
@mohitesachin217
mohitesachin217 / regular express
Created June 19, 2016 13:27
search textfiles with regular expressions
--grep,
--fgrep,
--egrep
--regex
grep search through stream
syntax
grep [string to find] [file name]
@mohitesachin217
mohitesachin217 / wildcards
Created June 19, 2016 11:23
wildcards in linux
wildcards or globbing
x -- anything
? -- any single character
! -- not(stuff)
[ac] -- a,c
[a-c] -- a,b,c
find
@mohitesachin217
mohitesachin217 / commanline
Last active June 19, 2016 09:14
working with commandline
--- bash
enter the command
cat /etc/passwd
and you will see the list of all the user names and bash assigned to the user
Ex.kia:x:2000:2000:kia,,,:/home/kia:/bin/bash
each bash has it's configuration as well as global configuration
global configuration file is stored in
@mohitesachin217
mohitesachin217 / debian-package-management
Last active June 19, 2016 08:32
debian package management system
dpkg
dpkg-reconfigure
APT
--apt-get , apt-cache
--configuration
aptitute
dpkg is the program is used to installing debian pacakages
dpkg -l firefox to see if firefox installed and the information about the firefox
Lilo -- linux loader
grub -- grand unified boot loader
backup MBR --
@mohitesachin217
mohitesachin217 / php email template with headers
Created June 18, 2016 13:24
php email template with headers
<?php
/* echo "<pre>";
print_r($_POST);
echo "</pre>";*/
//ini_set('display_errors', 'On');
//set_error_handler("var_dump");
/**
* function to filter sql injections and illegal characters inside the input
@mohitesachin217
mohitesachin217 / chrome.txt
Created June 15, 2016 05:30
google chrome search engine forced by administrator remove commands
RD /S /Q "%windir%\System32\GroupPolicyUsers"
RD /S /Q "%windir%\System32\GroupPolicy"
gpupdate /force