Skip to content

Instantly share code, notes, and snippets.

View ddimtirov's full-sized avatar
👺
I may be slow to respond.

Dimitar Dimitrov ddimtirov

👺
I may be slow to respond.
  • Tokyo, Japan
  • 02:48 (UTC +09:00)
View GitHub Profile
@ddimtirov
ddimtirov / .last_successful_build.8a9faf2276
Last active January 18, 2023 11:54
Jetbrains Downloader
1864
@ddimtirov
ddimtirov / loop.rb
Created August 31, 2021 00:13
Sonic PI Aug 2021
use_bpm 480
define :roll do |trigs, offset=0, duration=1, &block|
return sleep(duration) if trigs==0
roll_tick = duration.to_f / trigs
sleep roll_tick * offset if offset>0 && offset<1
trigs.times do
block.call
sleep roll_tick
@ddimtirov
ddimtirov / udpmulticast.md
Created May 13, 2019 11:14
UDP Multicast in Container Networking

UDP Multicast in Container Networking

If your application is built around UDP Multicast, you are probably used to having network issues and long negotiations with the corporate data center network teams. For me that was one of the things that made me procrastinate learning about cloud and container networking, but now I finally bit tha bullet and it turns out the situation is not as bad as I thought (not that great either).

I will assume you have done your homework about basic Docker networking, if you don't go read the doc overview.

So, as we know Docker has the following built-in network drivers:

  • None - no network - no multicast.
  • Host - no abstraction - multicast away!
@ddimtirov
ddimtirov / keybase.md
Created March 4, 2019 15:05
Keybase proof for ddimitrov

Keybase proof

I hereby claim:

  • I am ddimtirov on github.
  • I am ddimitrov (https://keybase.io/ddimitrov) on keybase.
  • I have a public key ASA7DCbHHZXnBpd19nhDwi0Bem4-wiNpZdwTjLn0G7zgDQo

To claim this, I am signing this object:

@ddimtirov
ddimtirov / GspGenerationScriptLoader.java
Last active October 30, 2018 05:33
Codegen templating engines
package io.github.ddimitrov.modellerator.groovy.generator;
import groovy.lang.Binding;
import groovy.lang.GroovyShell;
import groovy.lang.Script;
import org.codehaus.groovy.runtime.ResourceGroovyMethods;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
@ddimtirov
ddimtirov / 1. Keynote.md
Last active May 30, 2018 07:25
Tokyo Java Days 2018 notes

Highlights

  • long term roadmap for Java exists (Oracle is not reducing their investment despite shift in strategy to OSS and services)
  • opening up developments
  • cloud native recurring topic
  • money from services
  • new release model - same/better for devs, makes ent. pay
  • making Java the premier choice for cloud native is recurring topic

Notable Projects:

  • portola: containers (startup time, resource management)
@ddimtirov
ddimtirov / memento-intellij.md
Last active October 19, 2017 13:57
Creating mementos and demonstrating advanced code editing with with IntelliJ IDEA

Memento is one of the less popular GoF patterns, that is solving a niche but important problem - how to reset the state of an object to a specified historical state. Examples include: hitting Cancel in a dialog, transaction rollback, etc.

The below code shows how to implement mementos in idiomatic Java, with minimum boiler plate and taking advantage of the features of a modern IDE (I've used IntelliJ IDEA, if anybody creates an Eclipse version let me know - I will link to it).

Instructions

  1. Start with a data class like this one:
class DialogModel {
@ddimtirov
ddimtirov / Bad output
Created June 4, 2017 09:53
Spock bug: bad assertion message
Condition not satisfied:
"""\ $a foobar covfefe """ == """ $b foobar covfefe """
|
false
@ddimtirov
ddimtirov / summary.md
Last active May 29, 2017 08:37
Ansible Summary

This is a text file, click on the 'Raw' button to view as intended

Ansible

classpath () { jinfo -sysprops $1 | grep java.class.path | awk '{ print $3 }' | sed 's/:/\n/g' ; }

jps -q | xargs -n 1 classpath

@ddimtirov
ddimtirov / snippets.bash
Created May 25, 2017 02:14
Shell snippets
if ! out=`ansible-playbook yourplaybook.yaml`; then echo $out; fi
( ( do_something ; do_something_else ) > /dev/null ) 2>&1 | sed 's/^/doing_something: /g' >> /.../logs/cronerr.log