Skip to content

Instantly share code, notes, and snippets.

View freshlogic's full-sized avatar

Shawn Miller freshlogic

View GitHub Profile
function(game, team1, team2) {
var percentages = {
round5: { 1: 100, 2: 94, 3: 85, 4: 78, 5: 68, 6: 66, 7: 60, 8: 48, 9: 52, 10: 40, 11: 34, 12: 35, 13: 22, 14: 15, 15: 6, 16: 0 },
round4: { 1: 87, 2: 69, 3: 61, 4: 56, 5: 52, 6: 51, 7: 27, 8: 18, 9: 8, 10: 46, 11: 38, 12: 49, 13: 24, 14: 12, 15: 14, 16: 0 },
round3: { 1: 79, 2: 72, 3: 50, 4: 35, 5: 21, 6: 33, 7: 37, 8: 70, 9: 40, 10: 33, 11: 33, 12: 5, 13: 0, 14: 0, 15: 0, 16: 0 },
round2: { 1: 59, 2: 46, 3: 47, 4: 72, 5: 75, 6: 23, 7: 0, 8: 57, 9: 50, 10: 0, 11: 60, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0 },
round1: { 1: 57, 2: 48, 3: 64, 4: 23, 5: 50, 6: 67, 7: 0, 8: 50, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0 },
round0: { 1: 67, 2: 33, 3: 44, 4: 33, 5: 0, 6: 50, 7: 0, 8: 50, 9: 0, 10: 0, 11: 0, 12: 0, 13: 0, 14: 0, 15: 0, 16: 0 }
};
@echo on
cd /d "%~dp0"
if "%EMULATED%"=="true" if DEFINED APPCMD goto emulator_setup
if "%EMULATED%"== "true" exit /b 0
echo Granting permissions for Network Service to the web root directory...
icacls ..\ /grant "Network Service":(OI)(CI)W
if %ERRORLEVEL% neq 0 goto error
exports.xForwardedFor = function(req, res, next) {
if (!req.headers['x-forwarded-for']) {
if (req.headers['x-iis-node-remote_addr']) {
req.headers['x-forwarded-for'] = req.headers['x-iis-node-remote_addr'];
}
}
next();
};
@freshlogic
freshlogic / gist:fb9f912b030e0b8307b0
Last active August 29, 2015 14:04
ServiceConfiguration.Cloud.cscfg
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" serviceName="serviceName" osFamily="4" osVersion="*" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<Role name="WebRole">
<ConfigurationSettings />
<Instances count="2" />
</Role>
<NetworkConfiguration>
<VirtualNetworkSite name="VirtualNetwork" />
<AddressAssignments>
<InstanceAddress roleName="WebRole">
@freshlogic
freshlogic / gist:c2b3de000229a1b05221
Last active August 29, 2015 14:04
ServiceDefinition.csdef
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="example-com" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="WebRole" vmsize="Small">
<Certificates>
<Certificate name="example-com" storeLocation="LocalMachine" storeName="CA" />
</Certificates>
<Imports />
<Startup>
<Task commandLine="setup_web.cmd &gt; log.txt" executionContext="elevated">
<Environment>
@freshlogic
freshlogic / gist:6cf0c2a01e587ce95551
Created July 26, 2014 02:47
web-ip-security.cmd
powershell .\web-ip-security.ps1
%windir%\system32\inetsrv\AppCmd.exe unlock config /section:system.webServer/security/ipSecurity
@freshlogic
freshlogic / gist:962da8adcedfb6b759ec
Created July 26, 2014 02:50
web-ip-security.ps1
Import-Module ServerManager
Add-WindowsFeature Web-Ip-Security
%windir%\system32\inetsrv\AppCmd.exe set config -section:applicationPools -applicationPoolDefaults.startMode:AlwaysRunning
%windir%\system32\inetsrv\AppCmd.exe set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1")
If (Test-Path "cloud_package.cspkg") {
Remove-Item "cloud_package.cspkg" -Force
}
cd "WebRole"
iex "git reset --hard origin/master"
iex "git pull"
cmd /C "rmdir /S /Q node_modules"