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 / 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 / AWS.EC2.Windows.CloudWatch.json
Created September 15, 2017 14:29 — forked from kagarlickij/AWS.EC2.Windows.CloudWatch.json
CloudWatch config for WebAPI & AppServer
{
"EngineConfiguration": {
"PollInterval": "00:00:15",
"Components": [
{
"Id": "MemoryCounter",
"FullName": "AWS.EC2.Windows.CloudWatch.PerformanceCounterComponent.PerformanceCounterInputComponent,AWS.EC2.Windows.CloudWatch",
"Parameters": {
"CategoryName": "Memory",
"CounterName": "Available MBytes",
@solrevdev
solrevdev / AWS.EC2.Windows.CloudWatch.json
Created September 19, 2017 10:49
CloudWatch json for windows boxes
{
"IsEnabled": true,
"EngineConfiguration": {
"Components": [
{
"FullName": "AWS.EC2.Windows.CloudWatch.EventLog.EventLogInputComponent,AWS.EC2.Windows.CloudWatch",
"Id": "ApplicationEventLog",
"Parameters": {
"Levels": "1",
"LogName": "Application"