Skip to content

Instantly share code, notes, and snippets.

@Wasapl
Wasapl / BASH magic.md
Last active November 23, 2017 11:57 — forked from magnetikonline/README.md
Bash string manipulation cheatsheet.

Bash string manipulation cheatsheet

Removal
Delete shortest match of needle from front of haystack ${haystack#needle}
@Wasapl
Wasapl / replace_path.sh
Last active March 26, 2018 18:05
Replace JAVA path in PATH variable
# Asume there is path to java in PATH variable
# Asume there JAVA_HOME_8_x64 variable defined
# Asume you have sed
export PATH=$(echo $PATH| sed -r -e "s|(:?)/usr/lib/jvm/[^:]+|\\1$JAVA_HOME_10_X64/bin|")
2018/04/17 13:26:06 [INFO] Packer version: 1.2.2
2018/04/17 13:26:06 Packer Target OS/Arch: windows amd64
2018/04/17 13:26:06 Built with Go Version: go1.10
2018/04/17 13:26:06 Using internal plugin for amazon-ebs
2018/04/17 13:26:06 Using internal plugin for amazon-ebssurrogate
2018/04/17 13:26:06 Using internal plugin for digitalocean
2018/04/17 13:26:06 Using internal plugin for docker
2018/04/17 13:26:06 Using internal plugin for ncloud
2018/04/17 13:26:06 Using internal plugin for oracle-oci
2018/04/17 13:26:06 Using internal plugin for virtualbox-ovf
@Wasapl
Wasapl / ubuntu.json
Last active April 17, 2018 22:02
Next packer config fails to scp basicconfig.sh (https://github.com/hashicorp/packer/issues/6151)
{
"variables": {
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"iso_checksum_md5": "6a7f31eb125a0b2908cf2333d7777c82",
"user_home":"/home/vagrant",
"image_description": ""
},
"provisioners": [
{
$token="<Your_api_token>"
$accountName="<Your_account>"
$projectSlug="<Your_project_slug>"
$toFind = @("foo", "bar")
$headers = @{
"Authorization" = "Bearer $token"
"Content-type" = "application/json"
}