Skip to content

Instantly share code, notes, and snippets.

View solrevdev's full-sized avatar
💭
🤓

John Smith solrevdev

💭
🤓
View GitHub Profile
@solrevdev
solrevdev / Recommended_InnoDB_Buffer_Pool_Size.sql
Last active August 29, 2015 14:03
how much to set InnoDB_Buffer_Pool_Size on mysql box
@solrevdev
solrevdev / PlatformHelper.cs
Last active January 4, 2018 09:40
Class to help your code know if you are running on windows or mac/mono
public static class PlatformHelper
{
static readonly Lazy<bool> IsRunningOnMonoValue = new Lazy<bool>(() =>
{
return Type.GetType("Mono.Runtime") != null;
});
public static bool IsRunningOnMono()
{
return IsRunningOnMonoValue.Value;
@solrevdev
solrevdev / SubdomainRoute.cs
Created August 5, 2016 14:41 — forked from bjcull/SubdomainRoute.cs
A class to detect the subdomain and pass it through as a route parameter
public class SubdomainRoute : RouteBase
{
public override RouteData GetRouteData(HttpContextBase httpContext)
{
if (httpContext.Request == null || httpContext.Request.Url == null)
{
return null;
}
var host = httpContext.Request.Url.Host;
@solrevdev
solrevdev / homebrew-services-restart.sh
Last active August 22, 2016 10:19
use homebrew to restart mysql, redis and activemq
#!/bin/sh
brew services restart --all
@solrevdev
solrevdev / aws.iis-force-ssl.xml
Last active October 7, 2016 10:28
A web.config setting for forcing SSL on an IIS website sat behind an Amazon AWS Elastic Load Balancer
<system.webServer>
<rewrite>
<rules>
<rule name="HTTPS rewrite behind ELB rule" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" ignoreCase="false" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{SERVER_NAME}{URL}" />
</rule>
@solrevdev
solrevdev / add-www-prefix.web.config.xml
Created April 19, 2017 07:32
Add a www to requests to the apex domain in web.config transforms
<system.webServer>
<rewrite xdt:Transform="Insert">
<rules>
<rule name="Add WWW prefix to requests to apex domain" >
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTP_HOST}" pattern="^thedomain\.com" />
</conditions>
<action type="Redirect" url="https://www.thedomain.com/{R:1}" redirectType="Permanent" />
</rule>
@solrevdev
solrevdev / web.config.transform.xml
Created April 19, 2017 07:36
A simple example of how to add and replace web.config settings in transforms
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<!-- adds -->
<add key="Key.To.Insert" value="The-Value-To-Insert" xdt:Transform="Insert" />
<!-- replaces-->
<add key="Environment" value="Release" xdt:Transform="Replace" xdt:Locator="Match(key)" />
@solrevdev
solrevdev / GetSafePath.cs
Last active May 24, 2017 08:24
GetSafePath - given any path from any OS remove illegal characters and use the current OS Directory Seperator Char
public static string GetSafePath(string filePath)
{
if (string.IsNullOrEmpty(filePath)) return string.Empty;
//Strip invalid chars
foreach (var invalidChar in Path.GetInvalidPathChars())
{
filePath = filePath.Replace(invalidChar.ToString(), String.Empty);
}
@solrevdev
solrevdev / npm-list-globally.md
Created July 24, 2017 06:54 — forked from brenopolanski/npm-list-globally.md
Listing globally installed NPM packages and version
npm list -g --depth=0
@solrevdev
solrevdev / tasks.json
Created August 15, 2017 11:49
vscode tasks to run and watch .net core apps
// Microsoft.DotNet.Watcher.Tools
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [