Skip to content

Instantly share code, notes, and snippets.

@dantesun
dantesun / config-props.md
Created August 21, 2023 16:27 — forked from dsyer/config-props.md
Notes on Dynamic Configuration Properties

Dynamic Configuration Properties in Spring Boot and Spring Cloud

TL;DR

  • Use @ConfigurationProperties and always get state from the bean.
  • The Environment can change at runtime and Spring Cloud does this for you using RefreshEvent.
  • Changes are propagated to beans in Spring Cloud in 2 ways (@ConfigurationProperties and @RefreshScope).
  • If you care about the state of @ConfigurationProperties being consistent on concurrent access, put it or the consumer @Bean in @RefreshScope.

Typical Scenarios

from twisted.internet import reactor, defer, endpoints, task, stdio
from twisted.conch.client import default, options, direct
from twisted.conch.error import ConchError
from twisted.conch.ssh import session, forwarding, channel
from twisted.conch.ssh import connection, common
from twisted.python import log, usage
import signal
import tty
import struct
import fcntl
@dantesun
dantesun / gist:7942250
Created December 13, 2013 10:04
A bash script displaying only physical interfaces and mac address
#Collecting all physical interfaces's name and mac addresse
declare -A NAME_TO_MAC
set -e
for f in /sys/class/net/*; do
if [ -L $f ]; then
name=`readlink $f`
if echo $name | grep -v 'devices/virtual' > /dev/null; then
eval $(ifconfig `basename $f` | head -n 1 | awk '{print "NAME_TO_MAC[\"",$1,"\"]=",$5}' | tr -d ' ')
fi
fi
@dantesun
dantesun / gist:7767015
Created December 3, 2013 10:20
Create git repository with C/C++ files only and create tags
#!/bin/bash
DIR="$PWD"
GIT="/usr/bin/git"
echo "Generating tags in $DIR"
FILE_LIST=cscope.files
TAG_FILE=tags
if ! [ -d .git ]; then
echo "create Git repository"
data:text/html,
<style type="text/css">
#e {
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
font-size:16px;
}