Skip to content

Instantly share code, notes, and snippets.

@mjbommar
mjbommar / fuzzy-sentence-matching-python.py
Last active May 17, 2022 15:55
Fuzzy sentence matching in Python - Bommarito Consulting, LLC: http://bommaritollc.com/2014/06/fuzzy-match-sentences-in-python
# coding: utf-8
# ## IPython Notebook for [Bommarito Consulting](http://bommaritollc.com/) Blog Post
#
# ### **Link**: [Fuzzy sentence matching in Python](http://bommaritollc.com/2014/06/fuzzy-match-sentences-in-python): http://bommaritollc.com/2014/06/fuzzy-match-sentences-in-python
#
# **Author**: [Michael J. Bommarito II](https://www.linkedin.com/in/bommarito/)
# In[159]:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mjbommar
mjbommar / ipython-scientific.sh
Created November 17, 2013 15:57
Standard ipynotebook/scientific computing setup
virtualenv venv
./venv/bin/pip install https://github.com/numpy/numpy/archive/master.zip
./venv/bin/pip install cython
./venv/bin/pip install https://github.com/scipy/scipy/archive/master.zip
./venv/bin/pip install https://github.com/scikit-learn/scikit-learn/archive/master.zip
./venv/bin/pip install ipython pyzmq tornado
./venv/bin/pip install https://github.com/pydata/pandas/archive/master.zip
./venv/bin/pip install pyparsing
./venv/bin/pip install https://github.com/matplotlib/matplotlib/archive/master.zip
./venv/bin/pip install jinja2
@mjbommar
mjbommar / check_vpn_status.py
Created October 29, 2013 12:12
This script monitors and logs to CSV the status of all tunnels for all VPNs for a single EC2 region.
'''
@author Bommarito Consulting, LLC; http://bommaritollc.com/
@date 20131029
This script monitors and logs to CSV the status of all tunnels for all VPNs for a single EC2 region.
'''
# Imports
import boto
import boto.ec2
import boto.vpc
@mjbommar
mjbommar / run_orion.sh
Last active December 26, 2015 19:39
Run an Oracle ORION test in an automated fashion on a clean EC2 instance.
# Download and uncompress the ORION binary
wget http://bommarito-consulting.s3.amazonaws.com/app/oracle/orion_linux_x86-64.gz
gunzip orion_linux_x86-64.gz
# Output the attached storage device list, excluding the root volume
ROOT_DEVICE=`grep "/ ext4" /etc/mtab | awk '{print $1}'`
ls /dev/xv* | grep -v $ROOT_DEVICE > orion.lun
# Now run the actual test.
sudo ./orion_linux_x86-64 -run oltp -write 20 -verbose
@mjbommar
mjbommar / run_addm.sh
Created October 28, 2013 13:01
Shell script around run_addm.sql to run an ADDM report and archive it on S3
# Settings; ideally, you might be using Wallets
# or '/ as sysdba' and not need to drop your password in here.
ADDM_PATH=/home/oracle/scripts/addm/
ORACLE_USER=system
ORACLE_PASSWORD=tiger
ORACLE_TARGET=ORCL
S3_URI=s3://data.mycompany.com/oracle/addm/ORCL/
# Source Oracle environment variables, which should be in bash_profile
source ~/.bash_profile
@mjbommar
mjbommar / run_addm.sql
Last active December 26, 2015 18:39
Run an Oracle ADDM report over the last 24 hour period; only intended to be run on an instance, not a RAC service; Bommarito Consulting, LLC: http://bommaritollc.com/
SET pagesize 0;
SET heading off echo off feedback off verify off;
VARIABLE task_name VARCHAR2(40);
DECLARE
start_snap_id NUMBER := 0;
end_snap_id NUMBER := 0;
job_name VARCHAR2(255);
job_buff CLOB;
@mjbommar
mjbommar / rnotebook_install_run.R
Created October 27, 2013 18:41
rNotebook install and run
# Install and load required packages for rNotebook
install.packages(c('RCurl', 'devtools', 'shiny'), dependencies=TRUE, repos='http://cran.us.r-project.org')
require(devtools)
# Install rNotebook
install_github('rNotebook', 'ramnathv')
# Run rNotebook server
rNotebook::viewNotebook()
@mjbommar
mjbommar / rnotebook_prepare.sh
Last active December 26, 2015 17:19
rNotebook setup
# Install R and some required apt packages
apt-get update --fix-missing
apt-get install r-base-core r-recommended r-cran-xml libcairo2-dev libcurl4-openssl-dev
# Now download and execute the script to install and run rNotebook
cd /tmp
wget https://gist.github.com/mjbommar/7186297/raw/rnotebook_install_run.R
sudo R --vanilla < rnotebook_install_run.R
@mjbommar
mjbommar / plot_title_comparisons.R
Last active December 21, 2015 07:08
Compare Titles of the U.S. Code by some common measures.
# @date 20130818
# @author Bommarito Consulting, LLC; michael@bommaritollc.com
# @page http://bommaritollc.com/?p=1067
# Load libraries
library(ggplot2)
# Load data from git master
title_data <- read.csv('https://raw.github.com/mjbommar/us-code-complexity/master/results/table_data.csv',
header=T,