Skip to content

Instantly share code, notes, and snippets.

View anytizer's full-sized avatar

Bimal Poudel anytizer

View GitHub Profile
@anytizer
anytizer / ip-details.url
Created March 15, 2014 11:00
IP Details can be had from the URL
http://whois.domaintools.com/IP.ADD.RE.SS
@anytizer
anytizer / trigger-update.sql
Created March 21, 2014 07:53
Example of triggers updates
DROP TABLE IF EXISTS agro_produce_prices_histories;
CREATE TABLE agro_produce_prices_histories (
agro_produce_prices_history_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Price History ID',
price_date DATE NOT NULL DEFAULT '0000-00-00' COMMENT 'Date of produce price change',
produce_id INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Produce ID',
produce_price FLOAT(6,2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT 'Last Price',
PRIMARY KEY (agro_produce_prices_history_id)
) ENGINE=INNODB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS agro_produces;
@anytizer
anytizer / pre-commit.sh
Created March 22, 2014 08:31
Pre-Commit hook disallowing empty messages
#!/bin/sh
REPOS="$1"
TXN="$2"
# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
SVNLOOKOK=1
$SVNLOOK log -t "$TXN" "$REPOS" | \
grep "[a-zA-Z0-9]" > /dev/null || SVNLOOKOK=0
@anytizer
anytizer / update.sh
Created March 22, 2014 14:29
Upgrade the installer itself
yum upgrade yum
@anytizer
anytizer / triggers.sql
Created March 25, 2014 06:49
Bring triggers from your system base into databas tables.
SELECT trigger_name FROM information_schema.triggers WHERE trigger_schema = DATABASE();
-- Issues with NULL fields - accept NULLs
DROP TABLE IF EXISTS system_triggers_all;
CREATE TABLE `system_triggers_all` (
`trigger_name` VARCHAR(255) DEFAULT '',
`event_object_schema` VARCHAR(255) DEFAULT '',
`event_object_table` VARCHAR(255) DEFAULT '',
`event_manipulation` VARCHAR(255) DEFAULT '',
@anytizer
anytizer / linux-timezone-change.sh
Created March 25, 2014 07:00
Linux Timezone setup
# http://www.cyberciti.biz/faq/howto-linux-unix-change-setup-timezone-tz-variable/
ln -sf /usr/share/zoneinfo/EST localtime
@anytizer
anytizer / GRANTEE.sql
Created March 25, 2014 12:48
GRANTEE.sql
SELECT `PRIVILEGE_TYPE` FROM `INFORMATION_SCHEMA`.`USER_PRIVILEGES` WHERE GRANTEE='''root''@''localhost''' AND PRIVILEGE_TYPE='TRIGGER';
@anytizer
anytizer / default-ip-address.php
Created March 25, 2014 13:19
Find out the default IP address
<?php
$ip_address = '127.0.0.1';
if (!empty($_SERVER["HTTP_CLIENT_IP"]))
{
$ip_address = $_SERVER["HTTP_CLIENT_IP"];
}
else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
{
$ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
@anytizer
anytizer / day.sh
Created March 26, 2014 08:49
Week Day in capitals
# Week Day in capitals
DATE=`date '+%a'|tr '[:lower:]' '[:upper:]'`;
echo $DATE
@anytizer
anytizer / double-dollars.php
Created March 26, 2014 14:13
Dynamic Variables
<?php
$friend = 'John Doe';
$relation = 'friend';
echo $relation, ': ', $$relation;