Skip to content

Instantly share code, notes, and snippets.

@ebot
ebot / check_for_blocking.sql
Last active July 8, 2016 17:37
SQL Server Performance Tuning Queries
--Using sys.dm_exec_requests to find a blocking chain.....
--Here's a query that dumps the output of dm_exec_requests into a temporary table, then uses the XML PATH to transform the blocked_by list into a comma-delimited list in the row
--of the blocker. The sort order is the length of this comma-delimited list, putting the cause of a pileup right at the top.
--Doing this in a temp table was necessary because the blocking_session_id changes all the time. So keep in mind that the output of this query is several ms behind "live". But if you
--run it a few times, if there is an excessive blocker, the offending spid should be hanging out at the top and easy to see.
create table #ExecRequests (
id int IDENTITY(1,1) PRIMARY KEY
,session_id smallint not null
,request_id int
@ebot
ebot / ubuntu_bq_m10_tips.md
Last active April 26, 2016 17:31
BQ Aquaris M10 FHD 5 Ubuntu Frieza Phablet Issues/Tips

BQ Aquaris M10 FHD 5 Ubuntu Frieza Phablet Issues/Tips

Issue Resolution
Get microSD Working: Card recognized at first and was able to copy files out to it. Now its recognized, but cannot be seen in file manager and unmounting results in drive busy error.
Enable Apt-Get: http://bit.ly/1VUK2FW
Move Root Dir to SD Card: http://bit.ly/1YS3LUN
@ebot
ebot / .tmux.conf
Last active August 29, 2015 14:10
My tmux configuration
# Reload the tmux session with an updated config:
# tmux source-file ~/.tmux.conf
# make tmux display things in 256 colors
set -g default-terminal "screen-256color"
# bind vim keys to resize panes
bind-key -r j resize-pane -D 5
bind-key -r k resize-pane -U 5
bind-key -r h resize-pane -L 5
@ebot
ebot / make_echo_additions.rb
Created May 15, 2012 17:15
Splits unmatched accounts into an additions file for the mainframe.
#!/usr/bin/env ruby -wKU
input = File.new 'accounts.txt', 'r'
output = File.new 'additions.txt', 'w'
input.each_line do |line|
line = line.chomp.strip
enc = line.split '-'
output << " #{'%011d' % enc[0]}#{enc[1]}\n" unless line.nil?
end
@ebot
ebot / gist:1339448
Created November 4, 2011 14:31
Script that compresses all Mongo DBs except admin and local.
var hospitals = db.getMongo().getDBNames();
for(var h in hospitals){
if (hospitals[h] != "admin" && hospitals[h] != "local") {
var db = db.getMongo().getDB( hospitals[h] );
var size_before = ((db.stats()["dataSize"] / 60) / 60);
print( "Repairing DB " + db.getName() + " - " + size_before );
db.repairDatabase();
var size = ((db.stats()["dataSize"] / 60) / 60);
print( " Complete - " + size + ". Size reduced by " + ( size_before - size ) + " MB." );
}
@ebot
ebot / .gemrc
Created July 6, 2011 14:19
My Standard git, gem, and rspec configurations for Ruby development.
gem: --local --no-rdoc --no-ri
@ebot
ebot / gist:893675
Created March 30, 2011 01:03
Passenger Setup Notes
To fix server permissions
===========================
In httpd.conf (/etc/apache2)
* Comment out User and Group
* Add User <name of admin user>
Create App Entries
====================