Skip to content

Instantly share code, notes, and snippets.

James Skemp JamesSkemp

Block or report user

Report or block JamesSkemp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JamesSkemp
JamesSkemp / rpg-dice-roller.d.ts
Created Aug 17, 2019
TypeScript definitions for GreenImp/rpg-dice-roller
View rpg-dice-roller.d.ts
/** Declaration file generated by dts-gen */
/** For https://github.com/GreenImp/rpg-dice-roller */
/** This is a work in progress */
declare module "rpg-dice-roller" {
export class DiceRoll {
/**
*
* @param notation
*/
constructor(notation: string);
@JamesSkemp
JamesSkemp / find net version.linq
Created Apr 3, 2019
Find Installed .NET Version with LINQPad
View find net version.linq
<Query Kind="Program">
<Namespace>Microsoft.Win32</Namespace>
</Query>
// From https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
public static void Main()
{
Get45PlusFromRegistry();
}
View solr-patch-config
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
<sitecore search:require="solr">
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="sitecore_master_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
<param desc="core" patch:instead="param[@desc='core']">instance1_$(id)</param>
</index>
<index id="sitecore_core_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
@JamesSkemp
JamesSkemp / __.md
Last active Jun 7, 2018
Example getting first 10 requests from today's IIS logs and saving to dated txt file
View __.md

See https://stackoverflow.com/a/10945887/11912 for more information on the first two lines (today is being set just to help understand the date formatting).

If run 6/7/2018, it would check the IIS log at C:\inetpub\logs\LogFiles\W3SVC1\u_ex180607.log and save the output to _test180607.txt.

@JamesSkemp
JamesSkemp / elmah - class.cs
Last active Jan 29, 2018
Parse ELMAH XML files with LINQPad (C# Program)
View elmah - class.cs
void Main()
{
// Update with the path to Elmah.Errors/where the ELMAH logs are being stored.
var directoryPath = @"\\path\to\Elmah.Errors\";
var directory = new DirectoryInfo(directoryPath);
var files = directory.GetFiles("*.xml").OrderByDescending(f => f.CreationTime);
files.Count().Dump();
var messages = new List<string>();
@JamesSkemp
JamesSkemp / Search Files with Git Grep.ps1
Last active Jun 20, 2019
Use built-in Windows functionality to find a string of text in a directory.
View Search Files with Git Grep.ps1
# Can only be run within a Git repository, but this will also search untracked files, as well as those that are tracked.
git grep --untracked '<term>'
@JamesSkemp
JamesSkemp / Application Settings.md
Created Aug 24, 2017
Visual Studio Code Settings
View Application Settings.md

Application Settings

Extensions

  • Add jsdoc comments
  • C#
  • C# XML Documentation
  • Cordova Tools
  • PowerShell
  • seti-icons
View CREATE VIEW.sql
CREATE VIEW authorizer.ElevatedUserSiteRoles
AS
/*
DESCRIPTION: Used to display all elevated users with their specific site roles.
CALLED BY: SSMS.
*/
SELECT u.Id AS UserId, u.NetId, u.Added, u.SiteId, s.WiscWebId, s.Name AS SiteName, s.Url, s.DefaultRole, s.RequireWsb, u.RoleId, r.Name AS RoleName, r.[Description]
FROM authorizer.ElevatedUser u
LEFT JOIN authorizer.WiscWebSite s ON u.SiteId = s.Id
LEFT JOIN authorizer.AccessRole r ON u.RoleId = r.Id
@JamesSkemp
JamesSkemp / Distinctive Emails.md
Created May 17, 2017
LINQPad query to take a listing of emails, with some items containing comma-delimited list of emails, and finds distinct ones.
View Distinctive Emails.md

LINQPad query to take a listing of emails, with some items containing comma-delimited list of emails, and finds distinct ones.

var emails = new List<string>()
{
"test.one@example.com",
"test.one@example.com, test.two@example.com",
"test.two@example.com"
};
View random rom commands.md

Move files into a subdirectory, Mac OS X.

for f in *.32x; do mv "$f" 32X; done
You can’t perform that action at this time.