This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reload bashrc function | |
function brc { | |
. /etc/bashrc | |
. ~/.bashrc | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -f /tmp/git-pull.pid ] | |
then | |
exit 0 | |
fi | |
cd /v2a/sites/mage/mage.base | |
GIT_OUTPUT=`git pull` | |
if [ "$GIT_OUTPUT" -eq "Already up-to-date." ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$start_date = strtotime('3 months ago'); | |
$start_quarter = ceil(date('m', $start_date) / 3); | |
$start_month = ($start_quarter * 3) - 2; | |
$start_year = date('Y', $start_date); | |
$start_timestamp = mktime(0, 0, 0, $start_month, 1, $start_year); | |
echo $start_timestamp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resolve_sub_dirs() { | |
path="" | |
path_arg="$1" | |
search="$path_arg/sub-"* | |
for command in $search; do | |
if [ -d "$command" ]; then | |
if [ "$path" != "" ]; then | |
path="$command:$path" | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: sub mytop [-u (username)] [-p (password)] | |
# Summary: Watch MySQL Processes / Queries | |
# Help: Take a snapshot of what mysql queries are running in one second intervals | |
# Reference: http://akrabat.com/software/the-watch-linux-command-line-tool/ | |
set -e | |
# Default Username & Password | |
_MYTOP_PASSWORD="-pYOURPASSWORD" # or "" for no password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# <daemonname> <summary> | |
# | |
# chkconfig: <default runlevel(s)> <start> <stop> | |
# description: <description, split multiple lines with \ | |
# a backslash> | |
### BEGIN INIT INFO | |
# Provides: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function load_queues($path) { | |
$queuesTemp = array(); | |
$contents = file_get_contents($path); | |
$contents = explode("\n", $contents); | |
foreach($contents as $content) | |
{ | |
if(!in_array(trim($content), $queuesTemp)) { | |
$queuesTemp[] = trim($content); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT TABLE_NAME, TABLE_ROWS FROM `information_schema`.`tables` WHERE `table_schema` = '<database_name>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT SUM(TABLE_ROWS) | |
FROM INFORMATION_SCHEMA.TABLES | |
WHERE TABLE_SCHEMA = '<database_name>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT CONCAT( | |
'SELECT "', | |
table_name, | |
'" AS table_name, COUNT(*) AS exact_row_count FROM ', | |
table_schema, | |
'.', | |
table_name, | |
' UNION ' | |
) | |
FROM INFORMATION_SCHEMA.TABLES |
OlderNewer