Skip to content

Instantly share code, notes, and snippets.

@srbs
srbs / updateall.sh
Last active May 17, 2016 07:36
Update all git/svn/mercurial repositories in any child directory of this script
#! /bin/bash
#guarantee you are in the directory you are in (src: http://stackoverflow.com/a/246128)
cd -P "$(dirname "$0")"
# basically traverse down all directories until you run across a
# .git/.svn/.hg/.fslckout/CVS directory/file, then update/pull the directory (stop traversing)
#updaterepo <folder type found> <path name to display>
@srbs
srbs / od.sh
Created October 7, 2012 07:16
diff any file using opendiff (svn, git, mercurial, fossil)
# function for .bash-profile or .bashrc
# od <file> [<file2>]
# diff's the given file using opendiff based on the file's vcs
# supports svn, git, mercurial, fossil, & CVS
# can specify any path, checks are done where the file is
# when file2 is specified, fall back to default opendiff behavior
od()
{
@srbs
srbs / DeregisterOffline.java
Created December 15, 2021 01:26
spring-boot-admin auto-deregister scheduled task when a replacement is online
import de.codecentric.boot.admin.server.domain.entities.Instance;
import de.codecentric.boot.admin.server.domain.entities.InstanceRepository;
import de.codecentric.boot.admin.server.domain.values.InstanceId;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Mono;
// inspired by: https://github.com/codecentric/spring-boot-admin/issues/535#issuecomment-493010425
// behaves similar to InfoUpdate, but _only_ deregisters when a replacement is online
public class DeregisterOffline {