Skip to content

Instantly share code, notes, and snippets.

View JamesSkemp's full-sized avatar

James Skemp JamesSkemp

View GitHub Profile
@JamesSkemp
JamesSkemp / Check Elmah Database usage.sql
Created March 6, 2014 22:45
Check's database usage for Elmah error logs.
use aspnetdb
exec sp_spaceused elmah_error
@JamesSkemp
JamesSkemp / Sitecore Find published items created and deleted.sql
Created April 11, 2014 18:53
Find items created and deleted as part of a recent Sitecore publish.
use XXX_Sitecore_Web
select top 100 h.Action, h.Category, h.ItemId, h.ItemVersion, h.ItemPath, h.UserName, h.Created
--select count(*)
from History h
where UserName = 'user'
and Created <= '2014-04-11 17:11:36.870'
and Created >= '2014-04-11 17:00:59.963'
-- Created and Deleted items are potentially disruptive changes. The rest could be bad, but ...
and h.Action in ('Created', 'Deleted')
@JamesSkemp
JamesSkemp / SitecoreFQ-SublayoutUsage
Created June 18, 2014 16:26
Sitecore - Fast query to find sublayout usage
fast://*[@__Renderings='%{FAAD00AE-A089-4AEF-989C-73917660FF48}%']
@JamesSkemp
JamesSkemp / Sitecore-Administrators.cs
Created July 14, 2014 20:06
Find Sitecore users with an Administrator Flag (may return some false positives)
// query against XXX_Sitecore_Core
var adminUsers = from profile in Aspnet_Profiles
join user in Aspnet_Users on profile.UserId equals user.UserId
where profile.PropertyNames.Contains("Administrator")
&& profile.PropertyValuesString.Contains("True")
select new { Profile = profile, User = user }
;
adminUsers
.OrderBy (u => u.User.LastActivityDate)
@JamesSkemp
JamesSkemp / 00 Helpful Git Commands.md
Last active April 29, 2022 17:32
Helpful Git commands

This content has been moved to https://git.jamesrskemp.com/.

Helpful Git Commands

The following is a dump of Git commands for use on your shell of choice.

@JamesSkemp
JamesSkemp / Sitecore Media Library Image Pull
Last active September 2, 2015 19:14
Select image items from Sitecore Media Library via SQL.
var imageTemplate = Guid.Parse("{F1828A2C-7E5D-4BBD-98CA-320474871548}");
var jpgTemplate = Guid.Parse("{DAF085E8-602E-43A6-8299-038FF171349F}");
var fileSizeField = Guid.Parse("{6954B7C7-2487-423F-8600-436CB3B6DC0E}");
// For checking image properties, the below can be used.
var imageWidthField = Guid.Parse("{22EAC599-F13B-4607-A89D-C091763A467D}");
var imageHeightField = Guid.Parse("{DE2CA9E4-C117-4C8A-A139-1FF4B199D15A}");
var mediaItems = (
from item in Items
@JamesSkemp
JamesSkemp / Rails Starter commands.bat
Created August 10, 2014 11:56
Commands to get started with a Ruby on Rails site
# start where you want the project directory to be created
# create a new directory for an application. pass -B to skip adding bundles (requires internet connection)
rails new application_name
# start in main project directory
# must run commands for a project out of bin directory
cd bin
# start Rails WEBrick server (on port 3000). ctrl + c will kill it
rails server
# create a new scaffold (object and CRUD)
@JamesSkemp
JamesSkemp / Get started with Atom
Last active August 29, 2015 14:05
Get started with Atom
# run as administrator
# if you haven't already, execution policy will need to be relaxed. This probably returns Restricted
Get-ExecutionPolicy
# switch to a lax policy
Set-ExecutionPolicy Unrestricted
# install Chocolatey
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
@JamesSkemp
JamesSkemp / Search TFS Messages
Created October 14, 2014 15:11
Command line search TFS commit messages
tf history /server:http://server:8080/tfs/xxx "$/path" /recursive /format:detailed > "c:\path\search.txt"
@JamesSkemp
JamesSkemp / Extract All Archives With 7-Zip
Created November 6, 2014 14:58
Extract all zip files with 7-Zip Command Line
7za x *.7z -oExtracted