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 / 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
@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:6769675
Last active December 24, 2015 08:19
create assessments nested cursor
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
drop table #objectmap
create table #objectmap (
iItem int identity,
@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: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 / 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 / PVbusplanner
Last active August 29, 2015 13:57
Prairie Valley bus planner export
declare @command varchar(1000)
IF OBJECT_ID('tempdb..#temptable') IS NOT NULL DROP TABLE #temptable
select distinct
S.cStudentNumber,
s.cGovernmentNumber as 'Government Number',
s.cLegalLastName as 'Legal Last Name',
s.cLegalFirstName as 'Legal First Name',
us.UF_1590,
@othtim
othtim / mCompareNonOwnershipFields.sql
Created March 31, 2014 23:09
post-migration database compare - needs to be redone from scratch
use eastcentral
SET NOCOUNT ON
GO
@othtim
othtim / fixcourseobjectives.sql
Created March 31, 2014 23:11
livingsky - fixcourseobjectives
update Settings set cValue='N' where cKey like 'LDAP/Login'
--begin transaction
declare @icourseObjectiveID int
declare @csubject varchar(500)
declare @mnotes varchar(500)
@othtim
othtim / parklandlocationlinker.sql
Created March 31, 2014 23:13
parkland (and generic) location linker
--function to trim street info
IF object_id(N'fn_doStuff', N'FN') IS NOT NULL
DROP FUNCTION fn_doStuff
GO
CREATE FUNCTION fn_doStuff
( @value nvarchar(500) )