Skip to content

Instantly share code, notes, and snippets.

View mxrss's full-sized avatar

Michael T Roth mxrss

  • TMZ
  • Temecula, Ca
View GitHub Profile
@mxrss
mxrss / Deploy to Msbuild
Created October 29, 2013 21:36
msbuild and msdeploy script
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="$(Configuration) == '' "></Configuration>
<MsDeployPath>C:\Program Files\IIS\Microsoft Web Deploy V3</MsDeployPath>
<DeployPackageLocation>SomePath</DeployPackageLocation>
<UserName>notauser</UserName>
<Password>NotAPassword</Password>
<MachineName>noteahost</MachineName>
<PackageLocation>SomePackage.Zip</PackageLocation>
</PropertyGroup>
@mxrss
mxrss / ESMSSQLMigrator
Created November 11, 2013 17:55
Use Powershell to hydrate objects and map if inital to elasticsearch using the MSSQL snappins.
Param(
[bool]$firstRun,
[Parameter(Mandatory=$true)]
[string]$dbServer,
[Parameter(Mandatory=$true)]
[string]$userName,
[Parameter(Mandatory=$true)]
[string]$password,
[Parameter(Mandatory=$true)]
[string]$esServerInstance,
@mxrss
mxrss / CouponScrapper
Created November 11, 2013 18:12
Uses powershell to scrape website content for coupon sites using their json api's.
# this grabs offers from stater bros.com
$coupons = $null
$json = Invoke-WebRequest -Uri "http://coupons.staterbros.com/Coupons/Index?pageSize=600&currentPage=1&filter=0&sort=1&couponType=4&brandName=AllBrands&_=1383513834477" | select-object -Property Content
$StaterBriosrawObj = ConvertFrom-Json $json.Content
$StaterBriosrawObj.CouponsGrid | Group-Object { $_.Name } | Sort-Object -Descending Count
$staterCoupons = $StaterBriosrawObj.CouponsGrid
$coupons += $staterCoupons | Select-Object @{Name="Brand"; Expression={ $_.Name.tolower() -replace "[^A-Za-z0-9_.\$@ ]","" }}, #-replace [char]174, '' -replace [char]8482, '' } },
@{Name="Category";Expression={ "N/A"}},
@mxrss
mxrss / gist:7794968
Created December 4, 2013 20:30
Sample Documentation In Remarks with Markdown.
/// <remarks>
/// ## Successfull Requests
///
/// Will have information about the User this information is broken down in the following. The return code will
/// be **200 OK**. The following breakdown of user entity information will be provided to the user.
///
/// | Element Name | Friendly Name | Description |
/// | -------------- | ------------- | -------------------------------- |
/// | userName | User Name |The name of the user in the system|
/// | firstName | First Name | The first name of the user in the system (if availble from authentication provider) |
@mxrss
mxrss / gist:7796283
Created December 4, 2013 21:54
Returns sample
/// <returns>
/// ## Successfull Requests
///
/// Will have information about the User this information is broken down in the following. The return code will
/// be **200 OK**. The following breakdown of user entity information will be provided to the user.
///
/// | Element Name | Friendly Name | Description |
/// | -------------- | ------------- | -------------------------------- |
/// | userName | User Name |The name of the user in the system|
/// | firstName | First Name | The first name of the user in the system (if availble from authentication provider) |
@mxrss
mxrss / gist:7797301
Created December 4, 2013 23:10
Add API help link to web api.
protected async override System.Threading.Tasks.Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
{
var baseHandler = await base.SendAsync(request, cancellationToken);
var content = await baseHandler.Content.ReadAsAsync<ResponseBase>();
if (content != null)
{
var apiDescription = request.GetActionDescriptor().Configuration.Services.GetApiExplorer().ApiDescriptions.Where(x => x.ActionDescriptor == request.GetActionDescriptor()).SingleOrDefault();
if (apiDescription != null)
@mxrss
mxrss / bootscript.sh
Created January 9, 2014 05:19
Use Vagrant
#!/usr/bin/env bash
apt-get update
# install elasticsearch
cd ~
sudo apt-get update
dpkg --get-selections | grep openjdk-7-jre || sudo apt-get install openjdk-7-jre -y
# download key
@mxrss
mxrss / Vagrantfile
Created January 9, 2014 05:27
Vagrant Configuration for redis, es, memcaches and mysql
Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.provision :shell, :path=> "bootstrap.sh"
config.vm.network "forwarded_port", guest: 3306, host: 3306
config.vm.network "private_network", ip: "192.168.50.4"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
@mxrss
mxrss / Copy-AWSQueue
Last active January 3, 2016 12:39
Powershell script to copy queues over for AWS
#make global to not inure this only once versus multiple times.
$aws_extensions = Get-Module -ListAvailable | where-object { $_.Name -eq "AWSPowerShell" }
<#
.SYNOPSIS
copy-awsqueue will allow you to copy messages from one queue to another without deleting
@mxrss
mxrss / Node Appliance POC
Created February 2, 2014 04:12
Simple Appliance with Node
var http = require('http');
var port = process.env.port || 1337;
var qs = require("querystring");
var os=require('os');
var child_process = require("child_process");
http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
var str = req.url.split('?')[1];
var ip = qs.parse(str);