Skip to content

Instantly share code, notes, and snippets.

View lawrencegripper's full-sized avatar

Lawrence Gripper lawrencegripper

View GitHub Profile
<# Custom Script for Windows #>
##Change to current dir
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
cd $dir
##Download the server install
Invoke-WebRequest http://netcologne.dl.sourceforge.net/project/jasperserver/JasperServer/JasperReports%20Server%20Community%20Edition%206.2.0/jasperreports-server-cp-6.2.0-windows-x64-installer.exe -outfile jsinstall.exe
##Install Jaspersoft Reporting community edition
@lawrencegripper
lawrencegripper / Backup-TableStorage.ps1
Last active August 21, 2017 13:00
Azure Table Storage Backup to File
param(
[parameter(Mandatory=$true)]
[string]$Account,
[parameter(Mandatory=$true)]
[string]$SASToken,
[parameter(Mandatory=$true)]
[string]$OutputDir
)
$ErrorActionPreference = "Stop"
public class AppInsightsTelemetryInitializer : ITelemetryInitializer
{
public void Initialize(Microsoft.ApplicationInsights.Channel.ITelemetry telemetry)
{
var userId = HttpContext.Current?.User?.Identity?.GetUserId();
telemetry.Context.User.AccountId = userId;
CheckAndAdd(telemetry, "UserId", userId);
using System;
using System.Threading.Tasks;
using EtcdNet;
using System.Linq;
namespace ConsoleApplication
{
public class Program
{
private const string ElectionKey = "/MasterElection/Status";
@lawrencegripper
lawrencegripper / listDocDbCollections.ps1
Created March 7, 2017 13:37
Uses docdb rest api from powershell to list the collections
$InstanceUrl = "https://something.documents.azure.com:443"
$DatabaseName = "dbname"
$AccessKey = "accesskey"
#Create a signiture for docdb in powershell
function Get-Signature {
param(
[parameter(Mandatory=$true)]
[string]$verb,
[parameter(Mandatory=$true)]
@lawrencegripper
lawrencegripper / RunSingleWebTestWithVars.ps1
Created March 10, 2017 09:15
Quick script to run a simple webtest from powershell, setting contextParameters and capturing the results.
#
# Run_PostDeployWebTest.ps1
#
Param(
[string][Parameter(Mandatory=$true)]$WebTestPath,
[string][Parameter(Mandatory=$true)]$PublicUrl,
[string][Parameter(Mandatory=$true)]$OutputDir,
[string]$OutputFileName = "WebTestResult.xml"
@lawrencegripper
lawrencegripper / Update-TrafficManagerProfile.ps1
Created March 10, 2017 09:17
Quick script to update a tm profile, enabling or disabling an endpoint. The script will ensure you never disable all endpoints.
#
# Update_TrafficManagerProfile.ps1
#
# Example Usage: .\Update-TrafficManagerProfile.ps1 -TMResourceName "lawrence-scratch-www" -ResourceGroup "lawrence-scratch" -ProfileName "example1" -DisableEndpoint
Param(
[string][Parameter(Mandatory=$true)] $TMResourceName,
[string][Parameter(Mandatory=$true)] $ResourceGroup,
[string][Parameter(Mandatory=$true)] $ProfileName,
[switch][parameter(ParameterSetName="enableSet")]$EnableEndpoint,
Login-AzureRmAccount
Save-AzureRmProfile "$PSScriptRoot\.lgazureprofile"
Get-AzureRmResourceGroupDeployment -ResourceGroupName "something" | ForEach-Object { Start-
Job -ScriptBlock {
param($deployment)
Select-AzureRmProfile -Path "$PSScriptRoot\.lgazureprofile"
$deployment | Remove-AzureRmResourceGroupDeployment
} -ArgumentList $_ }
$resourceGroupName = "some-deployment-group"
Login-AzureRmAccount
Save-AzureRmProfile "$PSScriptRoot\.azureprofile"
function Delete-History {
$batch = 80
Get-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName | ForEach-Object {
$batch = $batch -1
@lawrencegripper
lawrencegripper / UpdateHyperKubeImage.sh
Last active July 21, 2017 12:15
Quick and Dirty Kubernetes Update script
CURRENT="khenidak/hyperkube-amd64:kv1.5"
NEW="gcrio.azureedge.net/google_containers/hyperkube-amd64:v1.7.0"
SEDPATTERN="s|$CURRENT|$NEW|g"
sudo systemctl stop kubelet.service
sudo sed -i $SEDPATTERN /etc/kubernetes/manifests/*
sudo sed -i $SEDPATTERN /etc/kubernetes/addons/*
sudo sed -i $SEDPATTERN /etc/default/kubelet
sudo systemctl daemon-reload