Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
namespace Einstein.PowerShell | |
{ | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Diagnostics.Contracts; | |
using System.Globalization; | |
using System.Linq; |
<# | |
.Synopsis | |
Performance test for output suppression in PowerShell | |
.DESCRIPTION | |
Very basic performance test against different types of output suppression in PowerShell | |
Increase the value of the Iterations parameter to observe how performance impacts the different methods | |
javascript:!function(){var n,e,r,i;n=window,e=document.body,r=JSON.parse,i=JSON.stringify,n.isf||(e.innerHTML="<pre>"+i(r(e.innerText),null,4).replace(/\"(.*)[^\:]\:/g,'<span style="color:#9C3636">$1:</span>')+"</pre>",n.isf=!0)}(); | |
//usage: | |
//save as bookmark and click it whenever you open a json response in a browser tab/window |
Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
Function Get-ImageText() | |
{ | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$True,Position=0,ValueFromPipeline=$True)] | |
[String] $Path | |
) | |
Process{ | |
$SplatInput = @{ |
node { | |
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1' | |
echo 'No quotes, pipeline command in single quotes' | |
sh 'echo $BUILD_NUMBER' // 1 | |
echo 'Double quotes are silently dropped' | |
sh 'echo "$BUILD_NUMBER"' // 1 | |
echo 'Even escaped with a single backslash they are dropped' | |
sh 'echo \"$BUILD_NUMBER\"' // 1 | |
echo 'Using two backslashes, the quotes are preserved' | |
sh 'echo \\"$BUILD_NUMBER\\"' // "1" |
The paperclips game over at www.decisionproblem.com/paperclips/index2.html is great, but if you want to play the game indefinitely you can lose all progress if you clear browser cache or change laptop. | |
I wanted a way to create a save file and load it later, so I did. Use the below script to generate the output to load the current game state. | |
var saveGame=localStorage.getItem("saveGame"),savePrestige=localStorage.getItem("savePrestige"),saveProjectsActive=localStorage.getItem("saveProjectsActive"),saveProjectsFlags=localStorage.getItem("saveProjectsFlags"),saveProjectsUses=localStorage.getItem("saveProjectsUses"),saveStratsActive=localStorage.getItem("saveStratsActive"),restoreString="/************* COPY ALL TEXT BELOW THIS LINE AND SAVE IN A TEXTFILE SOMEWHERE. RUN IT IN ANY CHROME OR FIREFOX CONSOLE TO LOAD IT. *************/\nlocalStorage.setItem('saveGame', '"+saveGame+"') \nlocalStorage.setItem('savePrestige', '"+savePrestige+"') \nlocalStorage.setItem('saveProjectsActive', '"+saveProjectsActive+"') |
$bootstrap_wrapper = { | |
&chcp.com 65001 > $null | |
$exec_wrapper_str = $input | Out-String | |
$split_parts = $exec_wrapper_str.Split(@("`0`0`0`0"), 2, [StringSplitOptions]::RemoveEmptyEntries) | |
If (-not $split_parts.Length -eq 2) { throw "invalid payload" } | |
Set-Variable -Name json_raw -Value $split_parts[1] | |
$exec_wrapper = [ScriptBlock]::Create($split_parts[0]) | |
&$exec_wrapper | |
}.ToString() |
NOTE: it seems that somebody else beat me to this, so I'm not going to finish this
https://qiita.com/ussvgr/items/81b88653b2845b0f1bea
Prerequisites: