Skip to content

Instantly share code, notes, and snippets.

Jeremy Davis jermdavis

Block or report user

Report or block jermdavis

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
@jermdavis
jermdavis / keybase.md
Created May 29, 2019
Verifying myself for Keybase
View keybase.md

Keybase proof

I hereby claim:

  • I am jermdavis on github.
  • I am jermdavis (https://keybase.io/jermdavis) on keybase.
  • I have a public key ASBCmmvpawRgYxXAmGg-piQyK4YuE-VmHghwBDPTQGRWuAo

To claim this, I am signing this object:

@jermdavis
jermdavis / ClipboardFileTransfer.psm1
Last active Sep 6, 2019
A helpful PowerShell module that lets you move (smallish) files over the clipboard - useful when you have RDP access to a machine but are not allowed to share drives.
View ClipboardFileTransfer.psm1
function Write-EmbeddedFile
{
param
(
[string]$base64,
[string]$targetFile
)
process
{
$Content = [System.Convert]::FromBase64String($base64)
@jermdavis
jermdavis / Extract-TarGz.ps1
Created May 9, 2019
A PowerShell script that can extract .tar.gz files on Windows - with minimal dependencies to make it easy to use on servers.
View Extract-TarGz.ps1
[cmdletbinding(SupportsShouldProcess=$True)]
param(
# What .tar.gz file should be extracted? Must exist.
[Parameter(Mandatory=$True)]
[string]$FileToExtract,
# What folder should the files be extracted into? Does not need to exist
[Parameter(Mandatory=$True)]
[string]$TargetFolder,
@jermdavis
jermdavis / SolrInstall-SIF-Extension.psm1
Last active Mar 4, 2019
Installing Solr for Sitecore v9.1 using SIF's createcert.json - Blog post explaining this at: https://jermdavis.wordpress.com/2019/03/04/a-second-attempt-at-installing-solr-with-sif/
View SolrInstall-SIF-Extension.psm1
##
## private functions
##
#
# If necessary, download a file and unzip it to the specified location
#
function downloadAndUnzipIfRequired
{
Param(
@jermdavis
jermdavis / Either.cs
Created Feb 17, 2019
An attempt at an error-friendly pipeline
View Either.cs
public struct Either<SUCCESS, FAILURE>
{
private readonly bool _isSuccess;
private readonly SUCCESS _success;
private readonly FAILURE _failure;
public bool IsSuccess => _isSuccess;
public bool IsFailure => !IsSuccess;
public SUCCESS SuccessValue => _success;
@jermdavis
jermdavis / BasicPipeline.cs
Created Feb 15, 2019
An alternative example of a generic pipeline which includes logging behaviour
View BasicPipeline.cs
using System;
namespace LoggingPipeline
{
public interface IPipelineStep<INPUT, OUTPUT>
{
OUTPUT Process(INPUT input);
}
@jermdavis
jermdavis / AdvancedCache.aspx
Created Nov 27, 2018
A fix to make https://briancaos.wordpress.com/2017/05/01/sitecore-caching-clear-caches-individually/ work on Sitecore 8, plus a quick hack to view the contents of each cache
View AdvancedCache.aspx
<%@ Page language="c#" EnableEventValidation="false" AutoEventWireup="true" EnableViewState="false" %>
<%@ Import Namespace="System.Security.Permissions" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Threading" %>
<%@ Import Namespace="System.Security.Principal" %>
<script runat="server">
void Page_Load(object sender, System.EventArgs e)
{
Response.Buffer = false;
@jermdavis
jermdavis / FunctionScheduler.cs
Last active May 12, 2018
Simple scheduler class
View FunctionScheduler.cs
using System;
using System.Threading;
public class FunctionScheduler
{
private int _runEveryMs;
private Action _actionToRun;
private Timer _timer = null;
private object _lock = new object();
View ConfigServerRole.ps1
param(
[Parameter(Mandatory=$true)]
[string]$configFolder,
[Parameter(Mandatory=$true)]
[string]$configPattern,
[Parameter(Mandatory=$true)]
[string]$currentRoles
)
function Update-ConfigFile
@jermdavis
jermdavis / DownloadFromSitecore.ps1
Last active Nov 27, 2017
Download files from dev.sitecore.net from the commandline
View DownloadFromSitecore.ps1
param(
[Parameter(Mandatory=$true)]
[string]$url,
[Parameter(Mandatory=$true)]
[string]$target
)
function Fetch-WebsiteCredentials
{
$file = "dev.creds.xml"
You can’t perform that action at this time.