Skip to content

Instantly share code, notes, and snippets.

View jarek-przygodzki's full-sized avatar

Jarek Przygódzki jarek-przygodzki

View GitHub Profile
@jarek-przygodzki
jarek-przygodzki / install-rancheros-in-hyperv.txt
Last active February 12, 2020 12:51
RancherOS with Hyper-V
// Admin PowerShell
choco install docker-machine
// see https://rancher.com/docs/os/v1.x/en/installation/running-rancheros/workstation/docker-machine/
docker-machine.exe create -d hyperv `
--hyperv-memory 2048 `
--hyperv-boot2docker-url https://releases.rancher.com/os/latest/hyperv/rancheros.iso `
--hyperv-virtual-switch "Default Switch" `
RancherVM
@jarek-przygodzki
jarek-przygodzki / maven-buildtime-profiler.extensions.xml
Last active February 28, 2020 10:02
Maven Build Profilers ( for Maven 3.3.1+ you have to define the following .mvn/extensions.xml file)
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.0.0 http://maven.apache.org/xsd/core-extensions-1.0.0.xsd">
<extension>
<groupId>com.soebes.maven.extensions</groupId>
<artifactId>maven-buildtime-profiler</artifactId>
<version>0.2.0</version>
</extension>
</extensions>
@jarek-przygodzki
jarek-przygodzki / do-it-yourself-docker-toolbox.md
Last active January 23, 2020 22:24
How to Install Docker on Windows 10 Home aka do-it-yourself Docker Toolbox (using Chocolatey)

Powershell (admin)

choco install -y virtualbox docker-compose docker-cli docker-machine
# reboot
shutdown /r

Powershell

docker-machine create --driver virtualbox default
@jarek-przygodzki
jarek-przygodzki / vagrant-ubuntu-slow-boot.txt
Created January 15, 2020 09:57
Vagrant Ubuntu Cloud image slow boot due to missing ttyS0 (uartmode1 not set to a log file in virtualbox)
See https://bugs.launchpad.net/cloud-images/+bug/1829625
A workaroud
config.vm.provider 'virtualbox' do |v|
v.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"]
v.customize ["modifyvm", :id, "--uartmode1", "file", "./ttyS0.log"]
end
@jarek-przygodzki
jarek-przygodzki / wildfly-upgrade-galleon-and-galleon-plugins.sh
Created December 4, 2019 08:57
WildFly - Upgrade galleon and galleon-plugins
xmlstarlet ed -L -S -N 'x=http://maven.apache.org/POM/4.0.0' \
-u '/x:project/x:properties/x:version.org.jboss.galleon' -v '4.1.1.Final' \
-u '/x:project/x:properties/x:version.org.wildfly.galleon-plugins' -v '4.0.4.Final' \
pom.xml
@jarek-przygodzki
jarek-przygodzki / build-wildfly-and-camel.sh
Created December 2, 2019 08:52
Building WildFly Camel 9.1.0
git clone https://github.com/wildfly/wildfly-core.git /builds/wildfly-core
cd /builds/wildfly-core
git checkout -b galleon-update 7.0.0.Final
git clone https://github.com/wildfly/wildfly.git /builds/wildfly
cd /builds/wildfly
git checkout -b galleon-update 15.0.1.Final
git clone https://github.com/wildfly-extras/wildfly-camel.git /builds/wildfly-camel
cd /builds/wildfly-camel
@jarek-przygodzki
jarek-przygodzki / maven-add-timestamps-to-log.md
Created November 29, 2019 08:57
How to add timestamps to Maven log

Maven is using SLF4J for its logging. Its default binding is an extended simple logger flavor of SLF4J, which means it can be configured using simplelogger.properties file (in Maven conf/logging directory) or using system properties.

To add timestamps to log output we need two properties:

  • org.slf4j.simplelogger.showDateTime: a boolean to add the timestamp in the output
  • org.slf4j.Simplelogger.dateTimeFormat: a SimpleDateFormat which formats the timestamp activated by previous property

We can do it permamently in the simplelogger.properties file or add these system properties on the JVM, possibly using MAVEN_OPTS

-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS
@jarek-przygodzki
jarek-przygodzki / force-git-to-use-lf-everywhere.md
Created November 28, 2019 07:45
Force Git to use LF everywhere

It's safe to use LF everywhere now

git config --global core.eol lf
git config --global core.autocrlf input

Make sure all local files are recreated with the correct line-endings

@jarek-przygodzki
jarek-przygodzki / docker-shell-on-host.md
Last active August 17, 2022 03:50
Docker: get a shell on the host
$ docker run --privileged --pid=host -it alpine:3.8 \
nsenter -t 1 -m -u -n -i sh
  • --rm : removes the container after it is stopped
  • -ti (or -t -i) : adds a tty and leaves the standard input opened
  • --privileged : grants additional permissions to the container, it allows the container to gain access to the devices of the host (/dev)
  • --pid=host : use the host's Process ID Namespace. Allows the container to use the process tree of the Docker host (the machine in which the Docker daemon is running)
@jarek-przygodzki
jarek-przygodzki / ORA-01882.md
Last active May 18, 2023 22:23
ORA-01882: timezone region not found

JDBC client sends command to setup session when physical connection is established via a modified AUTH_ALTER_SESSION OCI attribute in the authentication phase.

If the JVM time zone is one of the magic constants in the oracle.sql.ZONEIDMAP class and oracle.jdbc.timezoneAsRegion = true (default) then AUTH_ALTER_SESSION looks like this (where Etc/UTC is the default timezone picked up by the JVM)

ALTER SESSION SET TIME_ZONE='Etc/UTC' NLS_LANGUAGE='POLISH' NLS_TERRITORY='POLAND' 

which can fail with