Skip to content

Instantly share code, notes, and snippets.

@theunbound
theunbound / qbt-forward-pia.ps1
Created July 25, 2021 22:29
PowerShell script to set the port forwarded by PIA in qBittorrent
# Setup
# -----
# We are taking advantage of the 'piactl' executable, which comes with
# the PIA Windows client, so make sure you have that, and
# qBitTorrent's web interface, which should be active and set to
# bypass authentication for localhost (both of those are in the WebUI
# section of qBT's settings dialog).
# This all requires that PIA, qBT and the script will all be running
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active March 6, 2024 18:14
Jenkinsfile idiosynchrasies with escaping and quotes
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"
package util
object Slug {
def apply(input:String) = slugify(input)
def slugify(input: String): String = {
import java.text.Normalizer
Normalizer.normalize(input, Normalizer.Form.NFD)
.replaceAll("[^\\w\\s-]", "") // Remove all non-word, non-space or non-dash characters
.replace('-', ' ') // Replace dashes with spaces