Home
MySQL get top 20 tables size from MySQL
- Details
Here is a handy little script to get the top 20 MySQL tables based on size
I was trying to free some space up on my zabbix server; the database had grown to a 6G within a few months. I needed to get the top offending table to see what kind of data was in there I could get rid of. Since I only use Zabbix mostly for at the moment monitoring and no so much reporting on things over time. I went with the history table.
TABLE | ROWS | Data | Idx | Total Size | IDX-Frac |
zabbix.history_uint | 36.95M | 1.81G | 0.97G | 2.78G | 0.53 |
zabbix.history | 6.59M | 0.32G | 0.17G | 0.50G | 0.53 |
zabbix.trends_uint | 4.23M | 0.29G | 0.00G | 0.29G | 0.00 |
SELECT CONCAT(table_schema, '.', table_name), CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA, CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx, CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size, ROUND(index_length / data_length, 2) idxfrac FROM information_schema.TABLES ORDER BY data_length + index_length DESC LIMIT 20;
WPL2USB
- Details
WPL2USB
This is a very simple program. It will take a windows playlist and copy the files to a USB drive or anything else that supports drive type mappings.I use it to put my Windows Play List onto a USB drive for my Nissan LEAF.
Some feature:
Playlist to Play Folder: (check the Use Playlist Name option), Copy files from a windows playlist to a destination folder with the destination folder being named the playlist and all song files copied to that folder. This feature will not copy to the destination the album or artist name. For example if you have 5 different artist each with multiple albums and the play list is called Mells Mix; on the usb drive there will be a folder called Mell Mix with just the songs in that folder (this ideal for the LEAF)
Clean Names: This remove any letters that don't fall into A-Z, a-z, 0-9, -,. , [space]
if you just need to copy and keep artist/album paths, just uncheck the Use Playlist Name option. You can download the .exe at WPL2USB.exe, this is a stand alone exe.
The git source code is located here https://github.com/mrosandich/WPL2USB
Screen Shot:
Results to my USB drive (Drive G )
Price to operate a Nissan leaf
- Details
I purchased a Nissan Leaf on May 12th; so what does it cost me in electricity?
Like most people I have an electric bill and I have tier billing. These are the tiers from Austin Energy:
Tier 1 first 500 kWh at $0.018 per kWh | $9.00 | |
Tier 2 next 500 kWh at $0.056 per kWh | $28.00 | |
Tier 3 next 500 kWh at $0.072 per kWh | $36.00 | |
Tier 4 next 1,000 kWh at $0.084 per kWh | $84.00 |
The Measure:
To measure how much power my charger consumes; I use a device called a Kill-o-Watt. It plugs in between the wall and the car charger.
Here are 2 average samples:
From a full charge I drove 31 miles and used 12.8 kWh.
From a full charge I drove 64.4 miles and used 25.72 kWH
My average is right around 35 miles a day and I only use this car for work, so 20 days a month. Last month was 715 miles.
The Math:
So from these two samples I can say 95.4 miles will use 38.52 kWH
Mathematically that works to be 100 Miles at 40.37 kWH or 1 mile = .4037 kWH
So depending on what tier I am in when charging the Leaf the price will vary.
I general get through all 4 tiers by the end of the month.
Tier 1 would be 179 miles at 0.4037kWH per mile = 72.161 kWH total * $0.018 = $1.29
Tier 2 would be 179 miles at 0.4037kWH per mile = 72.161 kWH total * $0.056 = $4.04
Tier 3 would be 179 miles at 0.4037kWH per mile = 72.161 kWH total * $0.072 = $5.20
Tier 4 would be 179 miles at 0.4037kWH per mile = 72.161 kWH total * $0.084 = $6.06
The Result:
So my drive to work of 715 miles cost me roughly $16.59 a month.
My Leaf: The 2 blue lights on the dashboard show the charge level. There are 3 lights total.
Kill-a-watt: This measure usage for anything you plugin to it.
ubuntu send xmpp to confernce
- Details
# apt-get install python-xmpp
create a file
# nano jabber_send.py
paste everything between the lines
#--------------------------------------------------------------------------------------------------------------
#!/usr/bin/python
import sys,xmpp,time
jidparams={}
jidparams['domain']="some.xmpp.server"
jidparams['username']="username"
jidparams['password']="passwords"
jidparams['resource']="Alerts"
if len(sys.argv) < 2:
print "Syntax: jabber_send JID msg_text"
sys.exit(0)
jabber_recipient=sys.argv[1]
msg_text=' '.join(sys.argv[2:])
jid=xmpp.protocol.JID(jidparams['username'] + "@" + jidparams['domain'])
cl=xmpp.Client(jid.getDomain(),debug=[])
con=cl.connect()
if not con:
print 'could not connect to Jabber server!'
sys.exit()
auth=cl.auth(jidparams['username'],jidparams['password'],resource=jidparams['resource'])
if not auth:
print 'could not authenticate!'
sys.exit()
if "conference" in jabber_recipient:
cl.sendPresence(jabber_recipient + '/Alerts')
time.sleep(1)
msg=xmpp.protocol.Message(jabber_recipient,msg_text,'groupchat')
else:
msg=xmpp.protocol.Message(jabber_recipient,msg_text,'chat')
id=cl.send(msg)
time.sleep(1)
cl.disconnect()
#--------------------------------------------------------------------------------------------------------------
save the file
useage
# chmod +x jabber_send.py
# jabber_send.py "
to wrap in a shell script:
#nano jabber_send.sh
paste everything between the lines
#--------------------------------------------------------------------------------------------------------------
#!/bin/sh
# If no argument was given on the commandline, stop
if [ $# -lt 2 ];then
echo "Not enough arguments provided to $0 require 3 arguments reciepient subject and msg"
exit
fi
/path_to/your/pyscript//jabber_send.py "$1" "$3"
#exit $?
exit 0
#--------------------------------------------------------------------------------------------------------------
give it execute
#chmod +x jabber_send.sh
Page 11 of 40