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 | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch/status of the current mercurial repository | |
# * the return value of the previous command | |
# | |
# USAGE: |
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 | |
DEV_SERVERS="dev-db001 dev-db002" | |
QA_SERVERS="qa-db001 qa-db002" | |
STAGE_SERVERS="stage-db001 stage-db002" | |
PROD_SERVERS="prod-db001 prod-db002" | |
MYSQL=`which mysql` | |
read -p "Which environment (dev, qa, stage, prod): " ENVIRONMENT |
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 | |
MASTER_PROCESS_FILE=/tmp/master_process_list.out | |
OUT_FILE=/tmp/process_list.out | |
SLEEP_TIME=5s | |
[email protected] | |
ps -wweo pid,euser,ruser,suser,fuser,comm,args | grep -v "ps -wweo pid,euser,ruser,suser,fuser,comm,args" | grep -v `basename $0` > ${MASTER_PROCESS_FILE} | |
while true; do |
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 | |
users_hosts=`mysql -B -N -e "select user, host from mysql.user;"` | |
echo "${users_hosts}" | while read user_host; do | |
user=`echo "${user_host}" | cut -f 1` | |
host=`echo "${user_host}" | cut -f 2` | |
if [ "${user}" != "root" ]; then | |
grants=`mysql -N -e "show grants for '${user}'@'${host}';"` | |
echo "${grants}" | while read grant; do | |
echo "${grant};" |
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_schema as 'schema', | |
table_name as 'table', | |
round(((data_length + index_length) / 1024 / 1024 / 1024), 0) 'gigs', | |
round((data_length + index_length) / | |
(select sum(data_length + index_length) | |
from information_schema.tables) * 100, 0) 'percent' | |
from information_schema.tables | |
order by (data_length + index_length) desc; |
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 | |
# | |
# This fixes an issue I had where the color profile of my external display wouldn't "stick". Had a corrupt cache file, this removes it. | |
# | |
sudo rm $(getconf DARWIN_USER_CACHE_DIR)com.apple.colorsync.profiles.`id -u` |
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
import getpass | |
import pymysql | |
import csv | |
def main(): | |
host = raw_input("DB hostname: ") | |
db = raw_input("Schema name: ") | |
user = raw_input("Username: ") | |
password = getpass.getpass("Password: ") | |
query_file = raw_input("Input SQL filename: ") |
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
<html> | |
<head> | |
<style> | |
body { background: #000000; } | |
h1 { margin-top: 10em; text-align: center; color: #ffffff; font-family: "Helvetica"; } | |
</style> | |
</head> | |
<body> | |
<h1>Hello, world!</h1> | |
</body> |