Skip to content

Instantly share code, notes, and snippets.

View mikebuchanon's full-sized avatar

Mike Buchanon mikebuchanon

View GitHub Profile
@mikebuchanon
mikebuchanon / angel_survey_results.sql
Created August 15, 2014 13:55
Query to find ANGEL survey results based on course and survey title
select le.COURSE_ID, a.LoginName, qdq.sequence [question_number],
replace(replace(replace(replace(cast(qq.question_text as nvarchar(max)),'<div>',''),'</div>',''),'<b>',''),'</b>','') [question_text],
case when qpa.value = '1' then 'Strongly Agree'
when qpa.value = '2' then 'Agree'
when qpa.value = '3' then 'Neutral'
when qpa.value = '4' then 'Disagree'
when qpa.value = '5' then 'Strongly Disagree'
else qpa.value
end as [response],
qpa.lastModified [last_modified]
@mikebuchanon
mikebuchanon / list-sessions.ps1
Created August 7, 2014 13:13
List Putty all Sessions and IPs from the registry
clear
$regpath = "HKCU:\Software\SimonTatham\PuTTY\Sessions"
$sessions = gci -path $regpath
foreach($session in $sessions){
$fixedsession = $session -replace 'HKEY_CURRENT_USER','HKCU:'
$sessionname = Split-Path $fixedsession -Leaf
Write-Host $($sessionname -replace 'RS:|%20|.public.','') `t`t $(Get-ItemProperty -path $fixedsession).HostName
}
@mikebuchanon
mikebuchanon / simpleModal-example.html
Last active December 31, 2015 23:09
Example modal announcement using jQuery and smartModal
<link href="//content.learntoday.info/javascript/smartModal/jquery.smartModal.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//content.learntoday.info/javascript/smartModal/jquery.smartModal.min.js"></script>
<script src="//content.learntoday.info/javascript/smartModal/jquery.cookie.js"></script>
<script>
$(function() {
$.smartModal({ overlayDelay: 300, hideDelay: 200, cookieExpires: 365 });
});
</script>
<div class="smartmodal auto once">Exciting Modal window that only shows once.<br>We've updated some stuff! It's really neat!
@mikebuchanon
mikebuchanon / gist:7945431
Created December 13, 2013 14:53
Find ANGEL courses with deleted forum posts based on semester
SELECT c.COURSE_ID,
lo2.TITLE [folder], lo.TITLE [forum_name],
dp.AuthorDisplayName,
dp.Subject,
CASE
WHEN dp.PostLevel = 0 THEN 'Post'
ELSE 'Reply'
END [post_type]
FROM DiscussionPost dp (nolock)
JOIN DiscussionForum df (nolock) ON df.ForumId=dp.ForumId
@mikebuchanon
mikebuchanon / example.js
Created August 8, 2013 21:55
Example of how to shove link into Moodle breadcrumbs via HTML/JavaScript...can be used with an 'invisible' HTML block
<script type="text/javascript">// <![CDATA[
var breadcrumb = document.getElementsByClassName('breadcrumb');
var li = document.createElement('li');
var a = document.createElement('a');
var linkText = document.createTextNode("my title text");
var sep = document.createElement('span');
var septext = document.createTextNode("/");
sep.appendChild(septext);
sep.className = "divider";
@mikebuchanon
mikebuchanon / badges-issued.sql
Created July 29, 2013 19:23
Find all badges issued for users in Moodle25
select mb.name as badgename,
mu.username,
to_timestamp(mbi.dateissued) as dateissued
from mdl_badge_issued mbi
join mdl_badge mb on mbi.badgeid=mb.id
join mdl_user mu on mu.id=mbi.userid
order by to_timestamp(mbi.dateissued);
@mikebuchanon
mikebuchanon / findwhodeletedforumpost.sql
Created July 24, 2013 20:57
Find who deleted a forum post in ANGEL based on course_id
select dl.coursecontext [course_id],
a.LoginName [user_who_deleted_post],
dl.actiondate [date_post_deleted],
a2.loginname [user_who_made_post],
dp.PostDate [date_posted],
dp.Subject [post subject],
dp.Body [post]
from DiscussionLog dl (nolock)
join ACCOUNTS a (nolock) on a.USERNAME=dl.UserId
join DiscussionPost dp (nolock) on dp.PostId=dl.PostId
@mikebuchanon
mikebuchanon / student_lsn_logs_report.sql
Created July 4, 2013 15:55
Another example of using SQL Variables in the ANGEL SQL Query Manager
SQLVAR: $course_id$ = [?Enter the Course ID in question]
SQLVAR: $login_name$ = [?Enter the loginname of the student in question]
SQLVAR: $filter$ = [?Enter a filter %quiz 02%, %02%, etc or % for all]
select ll.course_id, a.loginname, lo.TITLE, lo.OBJECT_TYPE, ll.access_date
from LSN_LOGS ll (nolock)
join LSN_OBJECTS lo (nolock) on lo.OBJECT_ID=ll.OBJECT_ID
join ACCOUNTS a on ll.USER_ID=a.USERNAME
where ll.COURSE_ID = $course_id$
and a.LoginName = $login_name$
and lo.TITLE like $filter$
@mikebuchanon
mikebuchanon / sqlvar_example.sql
Created July 4, 2013 15:42
An example of using SQL Variables in ANGEL's SQL Query Manager
-- This script finds a specific user in a specific course
SQLVAR: $COURSE_ID$ = [?Enter a course id]
SQLVAR: $USER_ID$ = [?Enter a user id]
--Execute the script
SELECT * FROM dbo.COURSE_ROSTER WHERE COURSE_ID LIKE $COURSE_ID$ AND USER_ID LIKE $USER_ID$
@mikebuchanon
mikebuchanon / gist:5912160
Created July 2, 2013 19:10
Enable Static File Compression on IIS6
REM Enable Statis File Compression on IIS6 Web Server
REM Requires that adsutil.vbs be installed in c:\inetpub\adminscripts
REM Enable Static File Compression
cscript.exe c:\inetpub\adminscripts\adsutil.vbs set w3svc/filters/compression/parameters/HcDoStaticCompression true
REM Tell server to only use 1G of Space
cscript.exe c:\inetpub\adminscripts\adsutil.vbs set w3svc/filters/compression/parameters/HcDoDiskSpaceLimiting true
cscript.exe c:\inetpub\adminscripts\adsutil.vbs set w3svc/filters/compression/parameters/HcMaxDiskSpaceUsage 1073741824
REM Support got GZIP and DEFLATE for the files with the following extensions