Skip to content

Instantly share code, notes, and snippets.

@lipkau
lipkau / Get-Uptime.ps1
Last active September 5, 2015 17:43
Get Computer's uptime
function Get-Uptime
{
<#
.SYNOPSIS
Get Computer's uptime
.DESCRIPTION
Returns the total time since the last reboot
.NOTES
@lipkau
lipkau / hashtable_transformation.ps1
Last active October 19, 2015 09:13
[BUG] Transform HashTable to Custom Object
Add-Type -TypeDefinition @"
using System;
namespace foo
{
public struct bar {
public Int64 id;
}
}
"@
@lipkau
lipkau / Format-Wide.ps1
Last active February 24, 2016 10:13
[PowerShell] ProxyFunction: Pivot Format-Wide output
function Format-Wide {
[CmdletBinding(HelpUri='http://go.microsoft.com/fwlink/?LinkID=113304')]
param(
[Parameter(
Position=0
)]
[System.Object]${Property},
[switch]${AutoSize},
[CmdletBinding()]
[OutputType([System.Management.Automation.PSModuleInfo])]
param(
# The name of the module to install from GitHub.
[Parameter(Position=0, Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[System.String[]]
$ModuleName,
# The scope from which the module should be discoverable.
@lipkau
lipkau / Get-ConfluenceVersion.ps1
Last active March 4, 2017 23:05
Fetch version of the confluence Server
function Get-ConfluenceVersion {
[CmdletBinding()]
param (
# Server
[Parameter(Mandatory = $true)]
[string] $ServerUrl
)
begin {
$response = Invoke-RESTMethod -Uri $ServerUrl
@lipkau
lipkau / Start-WebServer.ps1
Last active March 9, 2017 15:33
Create local http server using PHP.exe #powershell #helperFunction #workflow
<#PSScriptInfo
.VERSION 1.0
.GUID 9c74d64a-774d-4f5a-a8c4-485fd079e7bd
.AUTHOR
Oliver Lipkau <oliver@lipkau.net>
.COPYRIGHT
Oliver Lipkau
@lipkau
lipkau / html.json
Created May 19, 2017 15:21
Insert Snippet around selection with keybinding #vscode #sample
{
"make_strong": {
"prefix": "strong",
"body": [
"<strong>$TM_SELECTED_TEXT${1}</strong>${0}"
],
"description": "Encloses selected text in <strong></strong> tags"
},
"make_italic": {
"prefix": "italic",
@lipkau
lipkau / Upload-Changes.ps1
Last active October 16, 2017 08:41
[AtlassianPS] [JiraPS] Upload changes to Jira Issues
param(
# Path to the JSON file with the information to upload.
[Parameter(Mandatory = $true)]
[ValidateScript( { Test-Path $_ })]
[string]$InputFile,
# Credentials to use for the connection with Jira.
[Parameter(Mandatory = $true)]
[PSCredential]$Credential,
@lipkau
lipkau / New-Folder.ps1
Last active October 16, 2017 15:04
Create new folder and naviagte into it #powershell #helperFunction #workflow
function New-Folder
{
<#
.Synopsis
Create a new folder and navigate into it
.Description
Create a new folder and navigate into it
.Notes
@lipkau
lipkau / Initialize-Environment.ps1
Last active January 3, 2018 13:06
[AtlassianPS] [JiraPS] Set up the environment for JiraPS (Install, Import, Login)
function Initialize-Environment {
<#
.SYNOPSIS
Initialize the module
.DESCRIPTION
Setup the environment to work with JiraPS
.EXAMPLE
Initialize-Environment