This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- #1 Place this line at the top of any msbuild script (ie, csproj, etc) --> | |
<PropertyGroup><PowerShell># 2>nul || type %~df0|find /v "setlocal"|find /v "errorlevel"|powershell.exe -noninteractive -& exit %errorlevel% || #</PowerShell></PropertyGroup> | |
<!-- #2 in any target you want to run a script --> | |
<Target Name="default" > | |
<PropertyGroup> <!-- #3 prefix your powershell script with the $(PowerShell) variable, then code as normal! --> | |
<myscript>$(PowerShell) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S deno run --reload -A --ext=ts | |
` <#`; | |
import { readdir } from "node:fs/promises"; | |
import { join,resolve } from "node:path"; | |
import { argv } from "node:process"; | |
let size = 0; | |
let count = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S deno run --reload -A | |
` <#` | |
// this is all typescript code here. | |
console.log("we're running typescript using deno"); | |
/*#> | |
# this is PowerShell code here. | |
if (-not (get-command deno)) { irm https://deno.land/install.ps1 | iex } | |
deno run --reload -A ($MyInvocation.MyCommand.Path) @args | |
#*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] | |
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,5b,e0,3a,00,00,00,00,00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#fixed now! | |
Param( | |
[string]$html, | |
[string]$docx | |
) | |
# make the powershell process switch the current directory. | |
$oldwd = [Environment]::CurrentDirectory | |
[Environment]::CurrentDirectory = $pwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// ... somewhere in your cmdlet (might need to be PSCmdlet?) | |
private const BindingFlags BindingFlags = System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public; | |
// provided you have a tasty function to reflect private fields/properties | |
protected object TryGetProperty(object instance, string fieldName) { | |
// any access of a null object returns null. | |
if (instance == null || string.IsNullOrEmpty(fieldName)) { | |
return null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S bash # > NUL 2>&1 || echo off && goto init: | |
function shh() { return; } ; shh \\<<shh | |
## THIS IS THE START OF THE POWERSHELL SCRIPT ################################# | |
# Copyright 2018 the Deno authors. All rights reserved. MIT license. | |
# TODO(everyone): Keep this script simple and easily auditable. | |
$ProgressPreference='SilentlyContinue' | |
$ErrorActionPreference = 'Stop' | |
if ($v) { | |
$Version = "v${v}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Replace 'Bitcoin' On Webpages | |
// @namespace https://gist.github.com/fearthecowboy | |
// @description Replaces bitcoin on websites. | |
// @include http://* | |
// @include https://* | |
// @include file://* | |
// @exclude http://userscripts.org/scripts/review/* | |
// @exclude http://userscripts.org/scripts/edit/* | |
// @exclude http://userscripts.org/scripts/edit_src/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<## | |
FluentConsole Functions | |
(C) 2022 Garrett Serack | |
License: MIT | |
Usage: | |
dot source this into your script (. FluentConsole.ps1 ) | |
and then you can use the colon-prefixed functions. | |
You can separate colon-function calls with ';' or '|' or a newline. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S bash # > NUL 2>&1 || echo off && goto init: | |
function shh() { return; } ; shh \\<<shh | |
## THIS IS THE START OF THE POWERSHELL SCRIPT ################################# | |
write-host "Setting variable in powershell" | |
$env:abc=300 | |
return; | |
## THIS IS THE END OF THE POWERSHELL SCRIPT ################################### | |
<# |
NewerOlder