Skip to content

Instantly share code, notes, and snippets.

@ikoblik
ikoblik / exif_date.py
Last active June 19, 2024 06:31
Python script to update image creation and modification dates to the EXIF date.
#!/usr/bin/env python
# MIT License
# Copyright (c) 2023 Ivan Koblik
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@ikoblik
ikoblik / BST.java
Last active April 22, 2016 07:05
Implementation of in-order iterator over a binary search tree.
package bst;
public interface BST<T extends Comparable<T>> {
/**
* Returns the value of the current node.
*/
public T getValue();
/**
* Returns the left child node or null if there isn't one.
@ikoblik
ikoblik / TestConcurrency.java
Created May 9, 2013 06:02
Unit test to support the following issue report: https://github.com/bennidi/mbassador/issues/30
import static org.junit.Assert.assertTrue;
import java.util.concurrent.CountDownLatch;
import net.engio.mbassy.common.StrongConcurrentSet;
import org.junit.Test;
public class TestConcurrency {
/**
* In this test HashMap will cross capacity threshold multiple times in
* different directions which will trigger rehashing. Because rehashing
@ikoblik
ikoblik / scc.clj
Last active December 10, 2015 17:08
Strongly connected components implementation in Clojure.
(ns koblik.scc)
(defn dfs
"Depth first search. Short form of the method passes through all the
nodes of the graph even if it's disconnected .
(nodes-fn graph) expected to return list of all the nodes in the graph.
(child-fn graph node) expected to return list of all the nodes linked
to the given node.
Returns hash-map where nodes are associated with a pair :idx, :leader.
:idx stores finishing index of the node traversal (post-order counter)
:leader first finishing index of the current DFS."
(defn test [args]
(filter #(> % 5) args))