Skip to content

Instantly share code, notes, and snippets.

@zaenk
zaenk / java-oddities.md
Last active May 1, 2019 06:59
Mission Impossible: Java

Mission Impossible: Java

This gist is just a friendly reminder, mostly for me, about stuff that just don't work in Java. I've spent some (lots of) precious hours trying make it work,

AWT, Swing

  • java.awt.SystemTray with javax.swing.JPopupMenu
    • While not impossible, no matter how hard you try, it will never work on all platform properly. Just stick with the default, ugly one.
  • Changing the font of java.awt.MenuItem
@zaenk
zaenk / docker_volumes_win.md
Last active April 26, 2017 07:11
Docker volumes on Windows

Docker volumes on Windows

Docker for Windows needs a shared drive in order to use it as a root for shared volumes for containers. I don't feel like sharing my whole C: drive, or a creating a new partition on one of my existing disk solely for this purpose.

subst

First I tried to fix this with subst DOS command, it saved me once while I wanted to delete a really deep node_modules directory, but I wanted a solution where I can move around this mounted drive on the host.

Mount a VHD

@zaenk
zaenk / TestDbConfig.java
Created April 1, 2017 17:47
Minimal configuration file for integration tests with Spring and MariaDb4j
import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Lazy;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
@zaenk
zaenk / java_oom.md
Last active April 14, 2017 13:11
Docker on Ubuntu

Determine whether cgroups limit the available memory

  • Create Dockerfile for test
FROM ubuntu:16.04

RUN apt-get update && \
    apt-get install -y openjdk-8-jdk && \
    rm -rf /var/lib/apt/list/*
@zaenk
zaenk / dev_env_db_and_stubs_with_docker.md
Last active April 26, 2017 07:10
Set up dev environment with docker-compose

Set up dev environment with docker-compose

Python container

It is mostly (like a 100%) stolen from here

FROM ubuntu:16.04

RUN apt-get update -y
@zaenk
zaenk / .0-packer-ansible-wls.md
Last active June 19, 2024 21:51
Packer, Hyper-V, Ansible, Windows, WLS

Create Linux images on Windows with Packer

Prerequisites:

  • Windows 10 Pro
  • WLS, Ubuntu 16.04 (a.k.a.: Bash on Ubuntu on Windows)
  • Hyper-V
  • Packer (1.0.0, added to path)
  • Ansible (2.3.0, installed on WSL)
  • qemu-img (2.3.0, added to path)
@zaenk
zaenk / session_execution_policy.ps1
Created June 30, 2017 12:41
Sets the execution policy for the current session
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted
@zaenk
zaenk / Dockerfile
Created August 22, 2017 15:16
Ubuntu 14.04 container with sshd configured
FROM ubuntu:14.04
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:password' | chpasswd
# xenial
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# trusty
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
@zaenk
zaenk / ui-router-to-angular-router.md
Last active August 13, 2024 16:07
Migrating AngularJS UI Router to Angular Router

Migrating AngularJS UI Router to Angular Router

This migration path focuses on AngularJS UI Router and Angular Router interopability,

This method not good for everyone! The main characteristics of this path is that the AngularJS and Angular apps does not share the same layout. So new components are always introduced in Angular, old components are rewritten and downgraded for AngularJS. Migration of old modules happens at once, when almost all components are updated. UI Router states cannot be reused in Angular, so every state and listener should bre rewriten to routes and event listeners or strategies for Angular Router.

Prerequisites