Skip to content

Instantly share code, notes, and snippets.

View othtim's full-sized avatar

Tim Scott othtim

  • Edmonton, Alberta, Canada
View GitHub Profile
@othtim
othtim / crosstab.xml
Last active August 29, 2015 13:57
Crosstab report!
<?xml version="1.0" encoding="utf-8" ?>
<Report xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
guid="26785108-8124-4350-BAFA-1A20EE32762A">
<ReportInfo>
<ReportName>Report Card Crosstab Report</ReportName>
<Description />
<ReportType>XSL</ReportType>
<ReportExportFormat>PDF</ReportExportFormat>
<ReportFile>/Reports/XSLReportFiles/CUSTOM/Crosstab.xrp</ReportFile>
<RemoveDuplicates>true</RemoveDuplicates>
@othtim
othtim / gist:9179474
Last active August 29, 2015 13:56
simple http redirect server to point my domain at my blog
#!/usr/pkg/bin/perl
## httpd
##
use Socket;
use strict;
no strict "refs";
use IO::Socket;
#set values that can be changed in the .ini file
@othtim
othtim / gist:8798088
Last active August 29, 2015 13:56
GET a url continually
# dont point this at anyone
use IO::Socket;
use strict;
my ($hash, $result);
my $i = 1;
my $line;
my $data;
@othtim
othtim / gist:6769675
Last active December 24, 2015 08:19
create assessments nested cursor
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
drop table #objectmap
create table #objectmap (
iItem int identity,
@othtim
othtim / gist:6680680
Created September 24, 2013 05:21
randomize student/contact info beta
BEGIN TRANSACTION
--declare
declare @icounter int;
--remove some uniqueness
@othtim
othtim / gist:6625455
Last active December 23, 2015 11:01
shrink dbs
# never do this
declare @db varchar(255)
declare c cursor for
select name from sys.databases where is_read_only=0 and state=0
and name not in ('master','model','tempdb','msdb')
open c
fetch c into @db
while @@fetch_status=0
begin
# i dont remember what this is for
----
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
@othtim
othtim / gist:6233930
Last active December 21, 2015 02:19
Move values from db A to db B
<?php
echo "Retaining lookup tables <BR /><BR />";
///////////////////////////////////////////////////////////////////////////////////////
@othtim
othtim / gist:6075658
Last active December 20, 2015 05:09
rebuild indexes with statistics
# this still needs some work
--save PRE stats on index fragmentation
IF OBJECT_ID('tempdb..#tmp_PRE_reindex', 'U') IS NOT NULL DROP TABLE #tmp_PRE_reindex
SELECT
ROW_NUMBER() over (order by sDips.index_id) as 'rowid',
OBJECT_NAME(sDips.OBJECT_ID) as 'objid',
si.name,
sDips.index_id,
@othtim
othtim / gist:6075601
Last active December 20, 2015 05:08
generate table of months, dates, hours. cross reference with actual useage data to avoid blank spaces in graphs.
# i dont remember if i wrote this, or took it from somewhere
select
month_number,
day_number,
hour_number,
isnull(d.data,0)
FROM
(