Skip to content

Instantly share code, notes, and snippets.

@davidhooey
davidhooey / oracle_execution_plan_for_sqlid.sql
Last active November 3, 2017 09:50
Oracle Execution Plan for SQL_ID
-- Shared Pool
select * from table(dbms_xplan.display_cursor('SQL_ID',null,'ALL'));
-- AWR
select * from table(dbms_xplan.display_awr('SQL_ID',null,null,'ALL'));
select * from table(dbms_xplan.display_awr('SQL_ID',null,DBID,'ALL'));
@davidhooey
davidhooey / p4merge4git.md
Created June 14, 2017 14:55 — forked from tony4d/p4merge4git.md
Setup p4merge as a visual diff and merge tool for git
@davidhooey
davidhooey / .tmux.conf
Last active December 2, 2016 19:24
tmux Configuration
set -g prefix C-a
set -sg escape-time 1
set -sg base-index 1
setw -g pane-base-index 1
setw -g mode-keys vi
set -g mouse on
bind r source-file ~/.tmux.conf \; display "Reloaded!"
@davidhooey
davidhooey / oracle_elapsed_time_for_sql.sql
Last active December 2, 2016 16:20
Oracle Elapsed Time Per Execution for SQL
-- Shared Pool
select *
from
(
select
case when executions = 0 then 0
else round(elapsed_time/executions, 3)
end "ElapsedPerExec(ms)",
elapsed_time "ElapsedTime (ms)",
executions "Executions",
@davidhooey
davidhooey / promisedRequest.js
Created October 19, 2016 14:03 — forked from anandsunderraman/promisedRequest.js
Node.js request with Q promises
//import the http library
var http = require('http'),
//npm install q before requiring it
Q = require('q');
//a js object with options
var googleNewsOptions = {
hostname: 'ajax.googleapis.com',
path: '/ajax/services/search/news?v=1.0&q=nodejs',
method: 'GET'
@davidhooey
davidhooey / geminabox
Last active May 24, 2016 21:48
GemInABox init.d Script
#! /bin/bash
# GemInABox
# Maintainer: David Hooey
### BEGIN INIT INFO
# Provides: geminabox
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Gem in a Box
@davidhooey
davidhooey / oracle_segment_advisor_for_individual_segments.sql
Last active January 26, 2016 21:23
Oracle Segment Advisor for Individual Segments
--
-- Segment Advisor for Individual Segments
--
-- 1. Replace all occurances of [OWNER] with the owner of the segments.
-- 2. Replace [TABLE_NAME] or [INDEX_NAME] with the segment to be analyzed.
set echo off
set feedback off
set verify off
@davidhooey
davidhooey / protips.js
Created January 3, 2016 23:49 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@davidhooey
davidhooey / oracle_holding_and_waiting_sessions.sql
Created October 25, 2013 16:36
Oracle Holding And Waiting Session
select
holders.*,
' IS BLOCKING ' is_blocking,
waiters.*
from
(
select
dw.holding_session,
hs.username,
do.object_name,
@davidhooey
davidhooey / oracle_byte_to_char_length_semantics.sql
Created October 25, 2013 14:42
Oracle Byte to Char Length Semantics
select
'alter table ' || table_name || ' modify ( ' || column_name || ' varchar(' || char_length || ' char) );'
from
user_tab_columns
where
data_type = 'VARCHAR2'
and
char_used = 'B'
order by
table_name,