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
# It might work in 4, but I'm not testing there. Lower you'll have to tweak code | |
#requires -Version 5.0 | |
param( | |
# Your Live ID for MSDN login | |
[Parameter(Mandatory)] | |
[PSCredential] | |
[System.Management.Automation.CredentialAttribute()] | |
$Credential, | |
# Pick a browser to use. Defaults to Firefox (which doesn't seem to require an external Driver file) |
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
import java.util.*; | |
import java.io.*; | |
import static org.junit.Assert.*; | |
import org.junit.Test; | |
@SuppressWarnings( "unchecked" ) | |
public class OutputCaptureTest { | |
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream(); | |
private final ByteArrayOutputStream errContent = new ByteArrayOutputStream(); |
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
<# | |
.SYNOPSIS | |
Converts files to the given encoding. | |
Matches the include pattern recursively under the given path. | |
.EXAMPLE | |
Convert-FileEncoding -Include *.js -Path scripts -Encoding UTF8 | |
#> | |
function Convert-FileEncoding([string]$Include, [string]$Path, [string]$Encoding='UTF8') { | |
$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
function ValidateXmlFile { | |
param ([string]$xmlFile = $(read-host "Please specify the path to the Xml file")) | |
$xmlFile = resolve-path $xmlFile | |
"===============================================================" | |
"Validating $xmlFile using the schemas locations specified in it" | |
"===============================================================" | |
# The validating reader silently fails to catch any problems if the schema locations aren't set up properly | |
# So attempt to get to the right place.... | |
pushd (Split-Path $xmlFile) |
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
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts, | |
that detects and handles AJAXed content. | |
Usage example: | |
waitForKeyElements ( | |
"div.comments" | |
, commentCallbackFunction | |
); |
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
#Powershell 4+ | |
#Fix of ShinNoNoir's script that broke with the new API | |
#https://gist.github.com/ShinNoNoir/d59ca5da3cd5c554a832 | |
function Get-VideoSeconds ([string]$VideoID){ | |
$gdata_uri = "https://www.googleapis.com/youtube/v3/videos?id=$VideoId&key=<APIKEY>&part=contentDetails" #Replace <APIKEY> | |
$metadata = irm $gdata_uri | |
$duration = $metadata.items.contentDetails.duration; | |
$ts = [Xml.XmlConvert]::ToTimeSpan("$duration") |
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
/** | |
* Sometime it happens while automating the angular app, view gets loaded entirely but performing any action | |
* on that view fails the test. This could happen because angular $http calls are still pending in backend. | |
* We can have explicit wait in this way to ensure that angular has made all the $http calls. | |
* Wait until angular finishes the $http calls while loading the view | |
*/ | |
public void waitForAngular() { | |
final String javaScriptToLoadAngular = | |
"var injector = window.angular.element('body').injector();" + | |
"var $http = injector.get('$http');" + |
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
package de.devsurf.chrome.extensions; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.OutputStream; | |
import java.security.InvalidKeyException; | |
import java.security.NoSuchAlgorithmException; | |
import java.security.PrivateKey; | |
import java.security.PublicKey; | |
import java.security.Signature; |
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
Add-Type -AssemblyName System.Windows.Forms | |
while ($true) | |
{ | |
$Pos = [System.Windows.Forms.Cursor]::Position | |
$x = ($pos.X % 500) + 1 | |
$y = ($pos.Y % 500) + 1 | |
[System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point($x, $y) | |
Start-Sleep -Seconds 10 | |
} |
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
<# | |
.SYNOPSIS | |
This script provides simple egg-timer like functionality. | |
.DESCRIPTION | |
This script counts down a time interval then speaks some text | |
.NOTES | |
File Name : Run-Timer.ps1 | |
Requires : PowerShell Version 2.0 |