Skip to content

Instantly share code, notes, and snippets.

View anytizer's full-sized avatar

Bimal Poudel anytizer

View GitHub Profile
@anytizer
anytizer / table-comments.sql
Created March 22, 2016 08:59
Comments in the tables
SELECT
TABLE_NAME, TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA=DATABASE()
AND TABLE_TYPE='BASE TABLE'
ORDER BY
TABLE_NAME
;
@anytizer
anytizer / wipe-out-tables.sql
Last active March 26, 2016 09:23
Wipe out WP_ tables from current database
SELECT
CONCAT('DROP TABLE `', t.table_name,'`;') drop_sql
FROM information_schema.TABLES t
WHERE
t.table_schema = DATABASE()
AND t.table_name LIKE 'wp\_%'
;
@anytizer
anytizer / php-constants.php
Created March 19, 2016 08:47
Database of PHP Constants
<?php
header('Content-Type: text/plain');
/**
* Fix to: Maximum execution time of 30 seconds exceeded.
* Loop can fail in-between otherwise.
*/
set_time_limit(0);
$mysqli = new MySQLi('localhost', 'USERNAME', 'PASSWORD', 'test');
@anytizer
anytizer / mysql admin.sql
Created September 8, 2014 07:33
Useful mysql admin functions
SHOW STATUS;
SHOW PROCESSLIST;
SHOW FULL PROCESSLIST;
KILL PROCESS 6607;
FLUSH LOGS;
FLUSH PRIVILEGES;
FLUSH HOSTS;
FLUSH TABLES;
FLUSH STATUS;
@anytizer
anytizer / newsletter pricing.txt
Created August 4, 2014 12:41
Cost of mass emailing
Mail Chimp
http://mailchimp.com/pricing/
http://mailchimp.com/pricing/growing-business/
iContact
http://www.icontact.com/pricing/
Aweber
@anytizer
anytizer / environment.htaccess
Created August 3, 2014 13:21
Setting up environment variables in .htaccess
# http://stackoverflow.com/questions/17581102/setting-environment-variable-using-htaccess
# print_r($_SERVER);
# Sets anything
SetEnv SERVER_KEY "qwerty"
SetEnv ANY_NAME "Dummy Name"
# Overwrites
SetEnv PATH "/"
@anytizer
anytizer / typical-mysqld.sh
Created August 3, 2014 07:48
The typical mysqld production server configurations
root@server [/tmp]# mysqld --print-defaults
mysqld would have been started with the following arguments:
--innodb_file_per_table=1 --tmp_table_size=128M --max_heap_table_size=128M --query_cache_size=64M --thread_cache_size=64 --key_buffer_size=32M --max_allowed_packet=16M --table_cache=1024 --table_definition_cache=8192 --innodb_buffer_pool_size=128M --innodb_flush_method=O_DIRECT --open_files_limit=16384 --max_connections=100 --max_user_connections=25 --wait_timeout=20 --myisam_sort_buffer_size=2M --thread_concurrency=4 --slow_query_log=1 --log-output=TABLE --long_query_time=20
@anytizer
anytizer / drop-backup-tables.sql
Created August 3, 2014 07:40
Drop backup tables (that started with an underscore _).
SELECT CONCAT('DROP TABLE `', TABLE_NAME, '`;') DROP_QUERY FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME LIKE '\_%';
# Connects to XAMPP's cdcol database
CREATE SERVER server1
FOREIGN DATA WRAPPER mysql
OPTIONS (USER 'root', PASSWORD 'toor', HOST 'localhost', PORT 3306, DATABASE 'cdcol');
USE test;
CREATE TABLE `cds` (
`titel` VARCHAR(200) DEFAULT '' NOT NULL,
`interpret` VARCHAR(200) DEFAULT '' NOT NULL,
@anytizer
anytizer / trimmer.php
Created July 30, 2014 12:55
Trim php.ini file and make it slim.
<?php
header('Content-Type: text/plain');
# Trims .ini files
$lines = file('C:/xampp/php/php.ini', FILE_IGNORE_NEW_LINES);
$trimmed = array();
foreach($lines as $l => $line)
{
if(!preg_match('/^[;|#]/', $line))