Skip to content

Instantly share code, notes, and snippets.

@javafun
javafun / better_powershell.md
Created April 2, 2023 12:15 — forked from mh-firouzjah/better_powershell.md
how to add zsh-like theme and feature to windows powershell
View better_powershell.md

Better PowerShell

Theme | History | KeyBinding

MyPowershell

in order to make windows powershell more comfortable and add a some theme and features like history binding, auto complete on keypress and so on, if you have used linux teminl wiht zsh for example, we are going to make powershell like that as much as we can.

What we will achieve

View ohmyposhv3-v2.json
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
@javafun
javafun / Windows Defender Exclusions VS 2022.ps1
Created July 14, 2022 13:00 — forked from Braytiner/Windows Defender Exclusions VS 2022.ps1
Adds Windows Defender exclusions for Visual Studio 2022
View Windows Defender Exclusions VS 2022.ps1
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($userPath + '\Downloads\HeidiSQL_11.3_64_Portable') > $null
$pathExclusions.Add($userPath + '\.dotnet') > $null
View Microsoft.PowerShell_profile.ps1
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@javafun
javafun / Windows Defender Exclusions VS 2017.ps1
Created November 2, 2021 06:55 — forked from dknoodle/Windows Defender Exclusions VS 2017.ps1
Adds Windows Defender exclusions for Visual Studio 2017
View Windows Defender Exclusions VS 2017.ps1
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($userPath + '\AppData\Local\Microsoft\VisualStudio') > $null
$pathExclusions.Add('C:\ProgramData\Microsoft\VisualStudio\Packages') > $null
$pathExclusions.Add('C:\Program Files (x86)\MSBuild') > $null
$pathExclusions.Add('C:\Program Files (x86)\Microsoft Visual Studio 14.0') > $null
@javafun
javafun / TinyMCE.cs
Created July 8, 2021 04:58 — forked from adnanzameer/TinyMCE.cs
Allow valid HTML elements to TinyMCE 2.+ in Episerver 11
View TinyMCE.cs
using System.Collections.Generic;
using EPiServer.Cms.TinyMce.Core;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
namespace MySite.Business.Initialization
{
[ModuleDependency(typeof(TinyMceInitialization))]
public class ExtendedTinyMceInitialization : IConfigurableModule
View webpack.config.babel.js
/* global process :true, __dirname :true, module :true */
import path from 'path'
import webpack from 'webpack'
import minimist from 'minimist'
import TerserPlugin from 'terser-webpack-plugin'
import ManifestPlugin from 'webpack-manifest-plugin'
import PnpWebpackPlugin from 'pnp-webpack-plugin'
import safePostCssParser from 'postcss-safe-parser'
import HtmlWebpackPlugin from 'html-webpack-plugin'
View BuyBundleGetItemDiscount.cs
namespace EPiServer.Reference.Commerce.Site.Features.Promotions
{
using System.ComponentModel.DataAnnotations;
using EPiServer.Commerce.Catalog.ContentTypes;
using EPiServer.Commerce.Marketing;
using EPiServer.Commerce.Marketing.DataAnnotations;
using EPiServer.Core;
using EPiServer.DataAnnotations;
@javafun
javafun / build.yml
Created June 18, 2020 03:10 — forked from jraps20/build.yml
Cache NuGet Packages with Cache Task in Azure DevOps YAML
View build.yml
- powershell: | # generates a hash of all packages.config and saves each on a single line on 'hash.txt'
Get-FileHash -Algorithm MD5 -Path (Get-ChildItem packages.config -Recurse) >> hash.txt
Write-Host "Hash File saved to $pwd\hash.txt"
workingDirectory: src
displayName: 'Calculate and save packages.config hash'
- task: CacheBeta@0 # speed up builds by caching packages folder
inputs:
key: nuget|1|$(Agent.OS)|$(Build.SourcesDirectory)\src\hash.txt # hash map generated in previous step
path: $(Build.SourcesDirectory)\src\packages
@javafun
javafun / profile.ps1
Created May 21, 2020 11:41 — forked from sixeyed/profile.ps1
PowerShell profile with a Linux-style prompt and aliases for common Docker commands
View profile.ps1
function Prompt(){
$W = Split-Path -leaf -path (Get-Location)
$prompt = Write-Prompt "$($env:UserName)@$($env:ComputerName):" -ForegroundColor Green
$prompt += Write-Prompt $W -ForegroundColor DarkCyan
$prompt += Write-Prompt '>'
return ' '
}
function Remove-StoppedContainers {
docker container rm $(docker container ls -q)