Skip to content

Instantly share code, notes, and snippets.

View reaaz's full-sized avatar

Ray Silva reaaz

  • FormSwift
  • San Francisco, CA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am reaaz on github.
  • I am reaaz (https://keybase.io/reaaz) on keybase.
  • I have a public key ASDqHuw1sEhqc8jNPT4zORlFg3qcLXT-JIevAOh1yHZ_3Qo

To claim this, I am signing this object:

@reaaz
reaaz / check_sql_connections.sql
Created June 6, 2017 17:50
Check SQL Connections
SELECT
tmp.ipAddress,
-- Calculate how many connections are being held by this IP address.
COUNT( * ) AS ipAddressCount,
-- For each connection, the TIME column represent how many SECONDS it has been in
-- its current state. Running some aggregates will give us a fuzzy picture of what
-- the connections from this IP address is doing.
FLOOR( AVG( tmp.time ) ) AS timeAVG,
# http://www.gelens.org/2009/09/13/twisted-connectionpool-revisited/
from twisted.enterprise import adbapi
from twisted.python import log
import MySQLdb
class ReconnectingConnectionPool(adbapi.ConnectionPool):
"""Reconnecting adbapi connection pool for MySQL.
This class improves on the solution posted at
@reaaz
reaaz / ssl_verify.sh
Created November 13, 2013 21:58
Verify SSL certs on a domain.
openssl s_client -connect some-secure-domain.com:443 -showcerts | grep "^ "
@reaaz
reaaz / exec_with_output.py
Created August 11, 2012 07:35
Exec Command and Write Output to File
import os
import subprocess
def exec_with_output(command, command_dir, output_dir, output_filename):
"""Run command and write output to file
Args:
command: string, shell command to execute.
command_dir: string, directory to execute command from.
output_dir: string, directory to write output in.
output_filename: string, directory to write output in.
"""
@reaaz
reaaz / play_basketball.py
Created August 8, 2012 06:48
Automated Script to Play Google Basketball Game
#!/usr/bin/python
# Small Python/AppleScript to play the Google Doodle Basketball game
# at http://www.google.com/doodles/basketball-2012
# Current high score is 36. I'm sure that can be improved with better delay
# management.
# Directions: load the game in your browser, hit play, and exec the script.