Skip to content

Instantly share code, notes, and snippets.

@bastaramus
bastaramus / Jenkinsfile.groovy
Created February 10, 2021 08:28 — forked from Faheetah/Jenkinsfile.groovy
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"
@bastaramus
bastaramus / vpn_fix_wsl_routes.ps1
Created January 19, 2021 14:48
Powershell script to fix internet connection issue with WSL2 and CheckPoint VPN
[IPAddress]$IP_wsl = (Get-NetIPAddress -InterfaceAlias "vEthernet (WSL)" -AddressFamily "IPv4" | Select-Object IPAddress).ipaddress
$PrefixLength_wsl = (Get-NetIPAddress -InterfaceAlias "vEthernet (WSL)" -AddressFamily "IPv4" | Select-Object PrefixLength).prefixlength
$idx_vpn = (Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Check Point"} | Select-Object ifIndex).ifIndex
Function CIDRToNetMask {
[CmdletBinding()]
Param(
[ValidateRange(0,32)]
[int16]$PrefixLength=0
)
@bastaramus
bastaramus / git-anonymize
Last active March 19, 2020 15:27 — forked from Dmitriy-developex/git-anonymize
Anonymise Git history
#!/bin/sh
# Suppose you want to do blind reviewing of code (eg for job interview
# purposes). Unfortunately, the candidates' names and email addresses are
# stored on every commit! You probably want to assess each candidate's version
# control practices, so just `rm -rf .git` throws away too much information.
# Here's what you can do instead.
#At first clone a repo with --bare option.