Skip to content

Instantly share code, notes, and snippets.

jondlm / UnknownRecord.sql
Last active Dec 14, 2015
A TSQL helper stored proc to generate and insert your unknown records for you. Be sure to modify and test the stored proc before implementing it. It can be tested by not supplying the third @action parameter, and it can be executed by specifying a third @action parameter of ‘runit’. Credit to…
View UnknownRecord.sql
-- author:
-- create: 2013-03-08
-- description: this proc will take table name, schema name, and optional action parameters
-- and insert an "unknown" record into that dimension table for you. If you don't
-- specific the @Action parameter as 'runit', then it will only print the SQL
-- output for you.
create proc [helper].[UnknownRow]
@TableName sysname,
@TableSchema sysname = 'dbo',
jondlm / CompareTableColumns.sql
Created Mar 28, 2013
A TSQL helper stored proc for comparing the column names of two tables.
View CompareTableColumns.sql
-- =============================================
-- Author: Jon -
-- Create date: 2013-03-05
-- Description: Helper function for comparing columns between two tables.
-- =============================================
CREATE FUNCTION [helper].[fnCompareTableColumns] (
@baseTable varchar(250),
@compareTable varchar(250)
jondlm / Execute Sql Agent Job.ps1
Last active Dec 20, 2015
A small script to kick off a SQL agent job on SQL Server.
View Execute Sql Agent Job.ps1
Write-Host "Loading connection..." -ForegroundColor Yellow -NoNewline
$SqlConnection = New-Object System.Data.SqlClient.SqlConnection
Write-Host "Done." -ForegroundColor Green
#Set the connection string
$SqlConnection.ConnectionString = "Server=,<server name>;Database=<database name>;Integrated Security=True"
#Declare a SqlCommand object
$SqlCommand = New-Object System.Data.SqlClient.SqlCommand
jondlm / jslint-header.js
Created Sep 16, 2013
Node / browserify / jQuery jslint header
View jslint-header.js
browser: true,
node: true */
/*global $ */
jondlm / sql-server_row-count-and-size.sql
Last active Dec 28, 2015
Some general scripts for SQL Server to get a data about tables in your databases
View sql-server_row-count-and-size.sql
USE DatabaseName
CREATE TABLE #temp_table (
table_name sysname ,
row_count INT,
reserved_size VARCHAR(50),
data_size VARCHAR(50),
index_size VARCHAR(50),
unused_size VARCHAR(50))
jondlm /
Last active Sep 13, 2017
Xmodmap swap caps lock and ctrl

Create a file, like ~/.xmodmap and paste the following in it:

! Swap Caps_Lock and Control_L
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
jondlm / logger.js
Last active Aug 29, 2015
A flexible console logger for Node.js complete with log levels and color
View logger.js
// Logging levels:
// Usage:
// var log = require('./logger.js');
jondlm / q.js
Created Sep 22, 2014
Node style callbacks to q promises
View q.js
var Q = require('q');
var assert = require('assert');
// Node style callback
function echo(thing, callback) {
callback(null, thing + thing);
// Test code
jondlm / centos_shellshock_patch.yml
Created Sep 26, 2014
ShellShock fix Ansible playbook for CentOS
View centos_shellshock_patch.yml
- hosts: all
gather_facts: false
sudo: true
- name: check for shellshock bash vulnerability
shell: executable=/bin/bash env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
register: test_vuln
- name: update bash from yum if vulnerable
yum: name=bash
jondlm / sinon_example.js
Last active Aug 29, 2015
Mocha, Chai, and Sinon Example
View sinon_example.js
// `npm install -g mocha`
// `npm install chai sinon`
// Run with `mocha sinon_example.js`
var assert = require('chai').assert;
var sinon = require('sinon');
var clock = sinon.useFakeTimers();
// Sample function, this would normally be where you `require` your modules
var slow = function(cb) {