Skip to content

Instantly share code, notes, and snippets.

@Xainey
Xainey / Add-ConEmuTheme.ps1
Created August 27, 2016 00:06
Helper Script to Install Themes for ConEmu.
param
(
[string] $ThemeURL,
[string] $ConfigPath = "~\AppData\Roaming\ConEmu.xml"
)
cls
$ErrorActionPreference = "Stop"
#Config
@Xainey
Xainey / Vagrantfile
Created August 1, 2016 19:49
Vagrant/Docker Example for Gitlab/Jenkins
# -*- mode: ruby -*-
# vi: set ft=ruby :
#Docker Engine and Compose needs to be installed or added to provision.
ip_address = "192.168.30.30"
hostname = 'dockerbox.dev'
subdomains = ['git.dockerbox.dev', 'whoami.dockerbox.dev', 'jenkins.dockerbox.dev']
Vagrant.configure(2) do |config|
@Xainey
Xainey / docker-compose-install.sh
Created July 28, 2016 15:09 — forked from marszall87/docker-compose-install.sh
Simple script for installing latest Docker Compose on CoreOS >= 717.0.0
#!/bin/bash
mkdir -p /opt/bin
curl -L `curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r '.assets[].browser_download_url | select(contains("Linux") and contains("x86_64"))'` > /opt/bin/docker-compose
chmod +x /opt/bin/docker-compose
@Xainey
Xainey / coreos-hello-world
Created July 26, 2016 15:02
Create CoreOS vagrant box and forward hello world container.
git clone https://github.com/coreos/coreos-vagrant/
cd coreos-vagrant
cp {config.rb.sample,config.rb}
sed -i 's/#$forwarded_ports = {}/$forwarded_ports = { 8080 => 8080 }/g' config.rb
vagrant up
vagrant ssh
docker run -d --name web1 -p 8080:80 tutum/hello-world
exit
@Xainey
Xainey / RequireModules.ps1
Created June 20, 2016 18:51
Require/Install Modules for PSake Tasks
<#
Work in Progress
Sync-Modules -Package ("PSGallery/Pester:3.4.*", "PSGallery/PSake:*") -Scope CurrentUser -Force
Module version for Pester must be in the rage: <= 3.4.0 and > 3.5
Module version for PSake: latest
#>
function Sync-Modules
{
[CmdletBinding()]
@Xainey
Xainey / SMB-Jenkins-Publish-Module.ps1
Created June 17, 2016 15:52
SMB Powershell-NuGet Module Share using Jenkins
<#
.Example
Import-Module -Name BuildHelpers
Set-BuildEnvironment
$ModuleInfo = @{
RepoName = 'PoshRepo'
RepoPath = '\\server\PoshRepo'
ModuleName = 'BuildHelpersTest'
ModulePath = '.\BuildHelpersTest.psd1'
@Xainey
Xainey / Publish-SMB-Module.ps1
Created June 16, 2016 16:53
Posh SMB Module Repo build versioning
$repoName = 'PoshGallery'
$repoPath = '\\server\PoshGallery'
$moduleName = 'MyModule'
$modulePath = 'C:\Temp\MyModule.psd1' # Jenkins would determine path
# Resister SMB Share
if(!(Get-PSRepository -Name $repoName -ErrorAction SilentlyContinue))
{
Register-PSRepository -Name $repoName -SourceLocation $repoPath -InstallationPolicy Trusted
@Xainey
Xainey / tasks.json
Created May 27, 2016 19:42
VSCode Posh Tasks
// A task runner that invokes Pester to run all Pester tests under the
// current workspace folder.
// NOTE: This Test task runner requires an updated version of Pester (>=3.4.0)
// in order for the problemMatcher to find failed test information (message, line, file).
// If you don't have that version, you can update Pester from the PowerShell Gallery
// with this command:
//
// PS C:\> Update-Module Pester
//
// If that gives an error like:
@Xainey
Xainey / PoshLagrange.ps1
Last active May 24, 2016 19:56
Lagrange Interpolation in Powershell
<#
Lagrange Interpolation Example
#>
function Point($x, $y)
{
return [pscustomobject]@{
PSTypeName = 'Point'
x = $x
y = $y
@Xainey
Xainey / Send-WakeOnLan.ps1
Created May 18, 2016 17:05
Send WOL Packet
function Send-WakeOnLan
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$True, Position=1, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)]
[Alias("Name")]
[string[]] $ComputerName
)
Begin