Skip to content

Instantly share code, notes, and snippets.

View anytizer's full-sized avatar

Bimal Poudel anytizer

View GitHub Profile
@anytizer
anytizer / login_histories.sql
Created July 28, 2014 08:36
User login history
CREATE TABLE `login_histories` (
`history_id` INT(10) NOT NULL AUTO_INCREMENT,
`user_id` INT(10) NOT NULL DEFAULT '0',
`loged_on` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`timezone_offset` TIME,
`ip_isp` VARCHAR(255) NOT NULL DEFAULT '',
`ip_address` VARCHAR(255) NOT NULL DEFAULT '',
`ip_country` VARCHAR(255) NOT NULL DEFAULT '',
`ip_city` VARCHAR(255) NOT NULL DEFAULT '',
`client_browser` VARCHAR(255) NOT NULL DEFAULT '',
@anytizer
anytizer / profiling.sql
Created July 21, 2014 10:46
Time taken to complete transactions - Profiling
SELECT
query_id, state, ROUND(SUM(duration),5) AS `duration (summed) in sec`
FROM information_schema.profiling
#WHERE
# query_id = 1
GROUP BY state
ORDER BY `duration (summed) in sec` DESC;
@anytizer
anytizer / mantis-bugs-headers.txt
Created July 21, 2014 09:19
mantis bug tracker search headers in bug details page
<link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Text Search" href="http://DOMAIN/browser_search_plugin.php?type=text" />
<link rel="search" type="application/opensearchdescription+xml" title="MantisBT: Issue Id" href="http://DOMAIN/browser_search_plugin.php?type=id" />
<title>...</title>
@anytizer
anytizer / htpasswd.php
Created July 21, 2014 08:24
.htpasswd generator (needs to check)
<?php
# http://www.htaccesstools.com/articles/create-password-for-htpasswd-file-using-php/
# http://www.htaccesstools.com/htaccess-authentication/
# http://www.innvo.com/c/PHP/1311865299-htpasswd-manager
$users = array(
'admin' => 'admin',
'test' => 'test',
'user' => 'pass',
@anytizer
anytizer / users.sh
Created July 20, 2014 06:02
How to list all your USERs
http://www.linuxquestions.org/linux/answers/Networking/How_to_list_all_your_USERs
How to list all your USERs
cat /etc/passwd |grep "/home" |cut -d: -f1
@anytizer
anytizer / store-locator.txt
Created July 14, 2014 06:40
Store Locator with Google Map and MySQL Lat/Long
Creating a Store Locator with PHP, MySQL & Google Maps
https://developers.google.com/maps/articles/phpsqlsearch_v3?csw=1
http://gmaps-samples-v3.googlecode.com/svn/trunk/articles/phpsqlsearch/phpsqlsearch_map.html
What is the ideal data type to use when storing latitude / longitudes in a MySQL database?
http://stackoverflow.com/questions/159255/what-is-the-ideal-data-type-to-use-when-storing-latitude-longitudes-in-a-mysql
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>BMI</title>
<style type="text/css">
*
{
font-size: 24px;
}
@anytizer
anytizer / mysql logs.sql
Created July 13, 2014 08:17
List of useful mysql log based tweaks
PURGE BINARY LOGS BEFORE NOW();
SHOW BINARY LOGS;
SHOW SLAVE STATUS;
SHOW TABLE STATUS;
/**
[mysqld]
log-output=FILE
@anytizer
anytizer / svn-revision.sh
Created July 13, 2014 06:17
Current Subversion revision command
Current Subversion revision command
http://stackoverflow.com/questions/1991526/current-subversion-revision-command
svn info | grep "Revision" | awk '{print $2}'
svn info | awk '/Revision/ { print $2; }'
Permanently disabled functions
https://developers.google.com/appengine/docs/php/
The following functions have been permanently disabled in Google App Engine:
disk_free_space()
disk_total_space()
diskfreespace()
escapeshellarg() and escapeshellcmd()