Skip to content

Instantly share code, notes, and snippets.

# Processes taking most memory
ps -e -o pid,vsz,comm= | sort -n -k 2
# Total size of MySQL databases
SELECT table_schema "DB Name",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
GROUP BY table_schema;
Traceback (most recent call last):
File "python.py", line 114, in <module>
result = pbex.run()
File "/home/fahad/VMs/ansible2.5/local/lib/python2.7/site-packages/ansible/executor/playbook_executor.py", line 159, in run
result = self._tqm.run(play=play)
File "/home/fahad/VMs/ansible2.5/local/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 289, in run
play_return = strategy.run(iterator, play_context)
File "/opt/mitogen-0.2.1/ansible_mitogen/strategy.py", line 164, in run
ansible_mitogen.process.MuxProcess.start()
File "/opt/mitogen-0.2.1/ansible_mitogen/process.py", line 119, in start
@ayaz
ayaz / commit-msg
Last active December 20, 2016 15:41
commit-msg hook that checks for presence of Assembla's Time parameter in commit message.
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# cd /etc/sysconfig/network-scripts/
# echo ifcfg-eth0:0 <<EOF
DEVICE="eth0:0"
IPADDR="172.31.5.75"
ONBOOT=yes
NAME=eth0:0
NETMASK=255.255.255.0
EOF
#!/usr/bin/env python
import time
import json
import requests
client = “YOUR_CLIENT_NAME”
url = “http://localhost:4567/stashes/silence/%s” % client
import netifaces
def get_public_ip_list():
interfaces = netifaces.interfaces()
public_ip_list = []
for interface in interfaces:
# Only keep ethX interfaces.
if not interface.startswith(“eth”):
continue
# Discard interfaces that are up but without any IPs.

Keybase proof

I hereby claim:

  • I am ayaz on github.
  • I am ayaz (https://keybase.io/ayaz) on keybase.
  • I have a public key ASDvUqKKTSHYjkfI0QjS-cEc5BOpkM-9v2ogMqzbnsXhTQo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am ayaz on github.
  • I am ayaz (https://keybase.io/ayaz) on keybase.
  • I have a public key whose fingerprint is 524C 0B2B 00BF A233 44AC 6D92 6EC3 F19A A8FA 8271

To claim this, I am signing this object: