Skip to content

Instantly share code, notes, and snippets.

View bergmeister's full-sized avatar

Christoph Bergmeister bergmeister

View GitHub Profile
@bergmeister
bergmeister / Push-GitBranch.ps1
Created December 9, 2017 16:55
Push a new git branch and automatically set the upstream
# Pushes a new branch and automatically sets the upstream
function Push-It
{
$branch = git rev-parse --abbrev-ref HEAD
git push --set-upstream origin $branch
}
@bergmeister
bergmeister / Push-GitRepoAndSetUpstream.ps1
Last active December 13, 2017 23:50
Everytime one wants to push a new branch to the remote, one has to set the upstream and git even tells us how to. This helper pushes it and automatically set the upstream.
git push -u origin (git rev-parse --abbrev-ref HEAD)
@bergmeister
bergmeister / PowerShell Customization.md
Created March 10, 2018 12:33 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@bergmeister
bergmeister / PowerShell Customization.md
Created March 10, 2018 12:33 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@bergmeister
bergmeister / Set-AclRule.ps1
Last active March 12, 2018 12:58
Set-AclRule: Set 'Allow' permissions on a folder (and inherit those permissions) to overcome the limitations of Get-Acl and the Windows API
function Set-AclRule {
[CmdletBinding()]
Param
(
[Parameter(Mandatory)]
[ValidateScript( {$_.IndexOfAny([System.IO.Path]::GetInvalidPathChars()) -eq -1})]
[string] $Path,
# The user account
[string] $Identity,
@bergmeister
bergmeister / Build-PowerShellCoreMsi.ps1
Last active May 31, 2018 19:28
Build Windows Installer of PowerShell Core
ipmo .\build.psm1
Start-PSBootStrap # Check basic pre-requisites and that WiX is installed from here: https://github.com/wixtoolset/wix3/releases
Start-PSBuild -Clean -CrossGen -PSModuleRestore -Runtime win7-x64 -Configuration Release
ipmo .\tools\packaging\packaging.psd1
Start-PSPackage -Type msi -SkipReleaseChecks
@bergmeister
bergmeister / Install-DailyPwsh.ps1
Created May 20, 2018 09:53
Install daily PowerShell Core build
iex "& { $(irm 'https://aka.ms/install-pscore ' ) } -Daily"
@bergmeister
bergmeister / Install-PSReadlinePreview.ps1
Last active September 18, 2018 21:26
Install unofficial preview of PSReadline for VSCode (tested in Windows PowerShell 5.1)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-Webrequest 'https://github.com/PowerShell/vscode-powershell/files/2377341/psvsix.zip' -OutFile 'out.zip';
Add-Type -AssemblyName System.IO.Compression.FileSystem;
[IO.Compression.ZipFile]::ExtractToDirectory("$($pwd.path)\out.zip", $pwd.path);
code --install-extension ./PowerShell-v2-extremely-alpha.vsix; # works also with code-insiders
Remove-Item ./PowerShell-v2-extremely-alpha.vsix;
Remove-Item ./out.zip
#!/bin/sh
# Install Docker CE
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
@bergmeister
bergmeister / Install-Kubernetes.sh
Last active July 1, 2019 12:35
Install Kubernetes on Ubuntu 16 (basic setup for master and server)
#!/bin/sh
cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
# enable iptables bridge call