Skip to content

Instantly share code, notes, and snippets.

@zaenk
zaenk / k8s-secret-encode-decode.md
Created March 22, 2024 07:31
Encode decode base64 in simple kubernetes secrets yaml files

Goal

These scripts encode-decode yaml files, e.g. from

secret:
  greeting: aGVsbG8=

using ksd test.yaml it will overwrite the file contents to

@zaenk
zaenk / privileges.md
Created November 21, 2020 21:48
PostgreSQL grant privileges for future tables

Spring Boot makes database migration with Flyway or Liquibase almost effortless - but by default it will use the spring.datasource.* credentials when running the migrations, which kinda suggests that this user should have ALL PRIVILEGES on the schema. This is risky, because... well if you find this page, you probably familiar with poor little Bobby Tables.

Spring Boot also makes it possible to configure separate credentials for running database migrations with the spring.flyway.* or spring.liquibase.* properties.

I prefer app credetials this way: an app owner with ALL PRIVILEGES to run the migrations and an app user with least privileges, mostly CRUD or some limited EXECUTE for the app itself.

@zaenk
zaenk / git_ignore_changes_in_local_repo.md
Created July 18, 2019 15:02
git ignore changes in local repo

Context: working on a fork of a libraray that generates lots aof code for testing and also uses a subrepo. I only want to commit my changes. Also I would like to use VS Code's git support for that. I also do not want to modify the .gitignore file.

Steps to ignore these changes locally:

Add the directories to local exlude:

vi .git/info/exclude
@zaenk
zaenk / .bashrc
Created May 1, 2019 06:57
Git Bash for Windows with some proxy commands to WLS
#!/bin/bash
alias wbash="/c/Windows/System32/bash.exe"
convert_path() {
# repace GitBash /driveletters with WLS bash /mnt/driveletters
# note: this not works with 1 letter directory letters
params=$(echo $* | sed -e "s/\/\b\(.\)\//\/mnt\/\1\//g")
echo $params
}
@zaenk
zaenk / git_diff.patch
Created April 20, 2019 07:53
Packer ProxMox builder ignores HTTP errors when typing boot command
diff --git a/builder/proxmox/step_type_boot_command.go b/builder/proxmox/step_type_boot_command.go
index 89d50fb0d..04361ee21 100644
--- a/builder/proxmox/step_type_boot_command.go
+++ b/builder/proxmox/step_type_boot_command.go
@@ -26,7 +26,7 @@ type stepTypeBootCommand struct {
type bootCommandTemplateData struct {
HTTPIP string
- HTTPPort uint
+ HTTPPort int
@zaenk
zaenk / crashlog-2019-04-19.log
Created April 19, 2019 16:46
Packer ProxMox builder crashlog 2019-04-19
proxmox output will be in this color.
==> proxmox: Creating VM
==> proxmox: Starting VM
==> proxmox: Starting HTTP server on port 8836
==> proxmox: Waiting 10s for boot
==> proxmox: Stopping VM
==> proxmox: Deleting VM
Build 'proxmox' errored: unexpected EOF
@zaenk
zaenk / yii2-phan.md
Last active August 4, 2022 09:17
Configure phan static analysis tool for a Yii2 project

Configure phan static analysis tool for a Yii2 project

Prerequisites:

  • Windows 10
  • Git bash
  • XAMPP portable with PHP 7.0
  • php and composer on path

Steps to configure

@zaenk
zaenk / accessExternalSchema.md
Last active March 21, 2018 22:05
Java 9 accessExternalSchema

In Java 9, Java 10 location of the jaxp.properties changed to $JAVA_HOME/conf/jaxp.propertes. This is actually indicated by the JavaDoc of DocumentBuilderFactory#newInstance

Java version jaxp.properties location
1.8 or earlier $JAVA_HOME/jre/lib/jaxp.properties
9 or later $JAVA_HOME/conf/jaxp.properties
@zaenk
zaenk / spring_boot_servlet_container.md
Created February 27, 2018 09:38
Spring Boot on Servlet container

Many Spring Boot Starters are dependent on spring-boot-starter-tomcat, which causes deployments error on Wildfly. To which dependencies causing errors run the following command and exclude spring-boot-starter-tomcat module from them:

./gradlew dependencyInsight --dependency spring-boot-starter-tomcat --configuration compile
@zaenk
zaenk / README.md
Created January 5, 2018 14:36
iOS universal link checklist