Skip to content

Instantly share code, notes, and snippets.

View ferventcoder's full-sized avatar
🎯
Focusing

Rob Reynolds ferventcoder

🎯
Focusing
View GitHub Profile
@Thermionix
Thermionix / mount.iso.psm1
Last active November 15, 2022 10:39
powershell mount/unmount iso for all versions of windows
# Uses http://www.ltr-data.se/opencode.html/#ImDisk virtual disk driver for windows 7 or less
# Tries to use chocolatey to install imdisk
# Sample use case:
# Import-Module ".\mount.iso.psm1"
# Invoke-IsoExe "C:\test.iso" "setup.exe" "/passive"
function Mount-Iso([string] $isoPath)
{
if ( -not (Test-Path $isoPath)) { throw "$isoPath does not exist" }
@xavierdecoster
xavierdecoster / register a myget feed.markdown
Last active July 12, 2022 12:43
Store MyGet credentials in your roaming user profile NuGet.config

Execute the following script using your MyGet [feedUrl] and MyGet [username] , [password] and [apikey]. Run this from a commandline where you have access to nuget.exe (or set the path to your nuget.exe in a system environment variable).

Store credentials in machine-level nuget.config (non-transferable)

nuget setapikey [apikey] -source [feedUrl]
nuget sources add|update -Name [name] -source [feedUrl] -User [username] -pass [password]
public class SomeClass {
public void SomeMethod() {
this.Log().Info(() => "Here is a log message with params which can be in Razor Views as well: '{0}'".FormatWith(typeof(SomeClass).Name));
}
}
function ConvertTo-ChocoPackage {
<#
.SYNOPSIS
Convert a PowerShell module into a chocolatey package.
.DESCRIPTION
Convert a PowerShell module into a chocolatey package.
.EXAMPLE
Find-Module pester | ConvertTo-ChocoPackage
Find the module pester on a PS repository and convert the module to a chocolatey package.
@ferventcoder
ferventcoder / .bash-constants.sh
Last active July 29, 2020 18:51
Git bash setup
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
Yellow="\[\033[0;33m\]" # Yellow
Blue="\[\033[0;34m\]" # Blue
Purple="\[\033[0;35m\]" # Purple
@Iristyle
Iristyle / Bootstrap-EC2-Windows-CloudInit.ps1
Created January 24, 2012 20:38
Bootstrap Windows EC2 node with WinRM and CloudInit for making your own AMI
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install the CloudInit.NET service, 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 R2 Core x64 and Windows 2008 SP2 x86 AMIs provided
# by Amazon
#
# To run the script, open up a PowerShell prompt as admin
# PS> Set-ExecutionPolicy Unrestricted
# PS> icm $executioncontext.InvokeCommand.NewScriptBlock((New-Object Net.WebClient).DownloadString('https://raw.github.com/gist/1672426/Bootstrap-EC2-Windows-CloudInit.ps1'))
@Chirishman
Chirishman / MaintanenceDSC.psm1
Last active March 12, 2019 16:51
Class Based DSC resource for patching and rebooting during specified maintenance windows
class MaintenanceWindow {
[Bool]$Enabled = $true
[DateTime]$StartTime
[DateTime]$EndTime
[System.DayOfWeek[]]$DaysOfWeek = @([System.DayOfWeek]::Saturday, [System.DayOfWeek]::Sunday)
[ValidateSet('Weekly', 'Daily')][string]$Frequency
MaintenanceWindow ([DateTime]$StartTime, [DateTime]$EndTime, [String]$Frequency) {
$this.StartTime = $StartTime
$this.EndTime = $EndTime
@ferventcoder
ferventcoder / .gitconfig
Last active April 4, 2018 00:44
Cloud boxes setup
[user]
name = Chocolatey
email = chocolatey@realdimensions.net
[core]
autocrlf = false
editor = \"C:/Program Files (x86)/GitExtensions/GitExtensions.exe\" fileeditor
filemode = false
excludesfiles = C:/Users/rob/.gitignore
symlinks = false
[diff]
@bradwilson
bradwilson / InlineTask.targets.xml
Created March 11, 2012 00:41
Inline MSBuild task to download NuGet.exe
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
@smerchek
smerchek / windows_installer.pp
Last active October 17, 2016 13:29
Puppet for windows installers at Softek
# This is the basic structure for a Windows project puppet module at Softek
# We found that the Package type as provided by Puppet was not quite sufficient for our needs.
# Instead, we transfer the file, exec msiexec when it changes (while logging install output), and then ensure the service is running.
class some_project {
$installer = 'Project.Setup.msi'
$url = "puppet:///release/${installer}"
file { "c:/packages/${installer}":
ensure => 'file',
mode => '1777',