Skip to content

Instantly share code, notes, and snippets.

View binerdy's full-sized avatar

Alan Keller binerdy

  • Zuehlke
  • Zürich, Switzerland
View GitHub Profile
# PowerShell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/username/id/raw/'))"
$apps = @(
@{name = "Microsoft.AzureCLI" },
@{name = "Microsoft.PowerShell" },
@{name = "Microsoft.VisualStudioCode" },
@{name = "Microsoft.WindowsTerminal"; source = "msstore" },
@{name = "Microsoft.AzureStorageExplorer" },
@{name = "Microsoft.PowerToys" },
@{name = "Git.Git" },
@{name = "Docker.DockerDesktop" },
// For explanation of this regex see: https://www.codeproject.com/Articles/21080/In-Depth-with-RegEx-Matching-Nested-Constructions and
// https://www.codeproject.com/Articles/21183/In-Depth-with-NET-RegEx-Balanced-Grouping
private readonly Regex groupsRegex = new (@"(?>
\{\%(?=\w+\:) (?<DEPTH>)
|
\%\} (?<STATEMENT-DEPTH>)
|
.?
)*
(?(DEPTH)(?!))", RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnoreCase);
@binerdy
binerdy / powershell_snippets.md
Last active September 10, 2021 15:07
powershell snippets

powershell-snippets

File / Directory manipulation

Delete douplicate images

Get-ChildItem "*.jpg" | Get-FileHash | group -Property hash | where count -gt 1 | % { $_.group | select -skip 1 } | Remove-Item -Force -Confirm

Move specific files to folder

Get-ChildItem "*(optional).pdf" | Move-Item -Destination ./optional/
@binerdy
binerdy / cleanup_css_file.js
Created September 17, 2019 12:44
Clean up CSS
var fs = require('fs');
var csso = require('csso');
var cssbeautify = require('cssbeautify');
var pathToCss = `C:\\Users\\alme\\Documents\\Code Projects\\${null}`;
var css = fs.readFileSync(pathToCss, 'utf8');
// change CSS structure, i.e. don't merge declarations, rulesets etc
var result = csso.minify(css, {
restructure: true,