- Use
@ConfigurationProperties
and always get state from the bean. - The
Environment
can change at runtime and Spring Cloud does this for you usingRefreshEvent
. - 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
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credits to Louistiti from Drizzle Discord: https://discord.com/channels/1043890932593987624/1130802621750448160/1143083373535973406 | |
import { sql } from "drizzle-orm"; | |
const clearDb = async (): Promise<void> => { | |
const query = sql<string>`SELECT table_name | |
FROM information_schema.tables | |
WHERE table_schema = 'public' | |
AND table_type = 'BASE TABLE'; | |
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using: | |
// globby@11.0.4 | |
// chalk@4.1.2 | |
import globby from 'globby'; | |
import { dirname } from 'path'; | |
import { fileURLToPath } from 'url'; | |
import chalk from 'chalk'; | |
async function main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
# Thanks to https://visibilityspots.org/dockerized-cloudflared-pi-hole.html | |
# echo "alias dns-up='cd /path/to/folder; docker-compose up -d'" >> ~/.bash_profile | |
services: | |
dns-over-https: | |
container_name: dns-over-https | |
image: fardog/secureoperator:latest # google dns | |
# image: visibilityspots/cloudflared:amd64 # cloudflare dns | |
restart: unless-stopped | |
networks: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ "$AWS_PROFILE" = "" ]; then | |
echo "No AWS_PROFILE set" | |
exit 1 | |
fi | |
for region in $(aws ec2 describe-regions --region eu-west-1 | jq -r .Regions[].RegionName); do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################################################################ | |
# | |
# This script automates the installation of the UniFi controller software on the | |
# Raspberry Pi. | |
# | |
# http://www.technologist.site/ubnt | |
# | |
################################################################################ |
C02STG51GTFM:localstack mpandit$ make infra
. .venv/bin/activate; exec localstack/mock/infra.py
Starting local dev environment. CTRL-C to quit.
Starting local Elasticsearch (port 4571)...
Starting mock ES service (port 4578)...
Starting mock S3 server (port 4572)...
Starting mock SNS server (port 4575)...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Fancy ID generator that creates 20-character string identifiers with the following properties: | |
* | |
* 1. They're based on timestamp so that they sort *after* any existing ids. | |
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
* latter ones will sort after the former ones. We do this by using the previous random bits | |
* but "incrementing" them by 1 (only in the case of a timestamp collision). | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# names of latest versions of each package | |
export VERSION_PCRE=pcre-8.38 | |
export VERSION_OPENSSL=openssl-1.0.2d | |
export VERSION_NGINX=nginx-1.9.7 | |
# URLs to the source directories | |
export SOURCE_OPENSSL=https://www.openssl.org/source/ | |
export SOURCE_PCRE=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ |
NewerOlder