Skip to content

Instantly share code, notes, and snippets.

View sneal's full-sized avatar

Shawn Neal sneal

View GitHub Profile
@sneal
sneal / install-7zip.ps1
Created October 15, 2014 15:35
Install 7-zip
$version = '922'
$msi_file_name = "7z$version-x64.msi"
$download_url = "http://downloads.sourceforge.net/sevenzip/$msi_file_name"
(New-Object System.Net.WebClient).DownloadFile($download_url, "C:\Windows\Temp\$msi_file_name")
&msiexec /i "C:\Windows\Temp\$msi_file_name" INSTALLDIR='C:\7-zip' /qb
@sneal
sneal / instal-chef.ps1
Created October 15, 2014 15:38
Install Chef PowerShell script
$download_url = 'https://opscode-omnibus-packages.s3.amazonaws.com/windows/2008r2/x86_64/chef-client-11.12.4-1.windows.msi'
(New-Object System.Net.WebClient).DownloadFile($download_url, 'C:\\Windows\\Temp\\chef.msi')
Start-Process 'msiexec' -ArgumentList '/qb /i C:\\Windows\\Temp\\chef.msi' -NoNewWindow -Wait
@sneal
sneal / install-vmware-tools.ps1
Created October 15, 2014 15:40
Install VMWare tools PowerShell script
$version = '9.6.1'
# from /Applications/VMware Fusion.app/Contents/Library/isoimages/windows.iso
$iso_name = 'vmware_fusion_tools_windows_6.0.3.iso'
$download_url = "http://host.example.com/$iso_name"
(New-Object System.Net.WebClient).DownloadFile($download_url, "c:\windows\temp\$iso_name")
&c:\7-zip\7z.exe x "c:\windows\temp\$iso_name" -oc:\windows\temp\vmware -aoa | Out-Host
&c:\windows\temp\vmware\setup.exe /S /v`"/qn REBOOT=R`" | Out-Host
@sneal
sneal / vagrant-shell.ps1
Created October 30, 2014 20:08
Workaround issue in PS throwing FileNotFoundException on first run
$command = "<%= options[:command] %>" + '; exit $LASTEXITCODE'
$user = '<%= options[:username] %>'
$password = '<%= options[:password] %>'
$task_name = "WinRM_Elevated_Shell"
$out_file = "$env:SystemRoot\Temp\WinRM_Elevated_Shell.log"
if (Test-Path $out_file) {
del $out_file
}
@sneal
sneal / LoggingCallContextPreparator
Last active May 13, 2023 15:04
Logstash configuration
using System.Web;
using eProject.Framework;
using eProject.Framework.CallContextPreparation;
using eProject.Framework.PublicObjects;
using log4net;
using log4net.Util;
namespace Daptiv.Infrastructure.Logging
{
public class LoggingCallContextPreparator : ICallContextPreparator
@sneal
sneal / http_client.rb
Created January 7, 2015 02:15
Ruby NTLM Test
require 'socket'
require 'net/ntlm'
$:.unshift(File.dirname(__FILE__) + '/../lib')
$user = nil
$passwd = nil
$host = ARGV[0] || "localhost"
$port = 80
def header(f, host)
@sneal
sneal / Pbkdf2.cs
Last active May 13, 2023 15:04
Pbkdf2 with swappable HMAC
//Copyright (c) 2012 Josip Medved <jmedved@jmedved.com>
//2012-04-12: Initial version.
using System;
using System.Security.Cryptography;
using System.Text;
namespace Medo.Security.Cryptography {
@sneal
sneal / modify_src_header_footer.ps1
Created March 10, 2015 00:03
Prepends and appends to all files in a given dir
@sneal
sneal / Daptiv.sln.DotSettings
Created March 26, 2015 14:55
Template for applying ReSharper settings to a new Daptiv C# solution
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">Default: Full Cleanup</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/BLANK_LINES_AROUND_NAMESPACE/@EntryValue">1</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/CASE_BLOCK_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/CONTINUOUS_INDENT_MULTIPLIER/@EntryValue">1</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EMPTY_BLOCK_STYLE/@EntryValue">TOGETHER_SAME_LINE</s:String>
<s:String x:Key
@sneal
sneal / Daptiv.ruleset
Created March 27, 2015 21:39
FxCop ruleset
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Daptiv All Rules" Description="This rule set contains all rules. Running this rule set may result in a large number of warnings being reported. Use this rule set to get a comprehensive picture of all issues in your code. This can help you decide which of the more focused rule sets are most appropriate to run for your projects." ToolsVersion="11.0">
<IncludeAll Action="Warning" />
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1000" Action="Error" />
<Rule Id="CA1001" Action="Error" />
<Rule Id="CA1002" Action="Error" />
<Rule Id="CA1003" Action="Error" />
<Rule Id="CA1004" Action="Error" />
<Rule Id="CA1005" Action="Error" />