Skip to content

Instantly share code, notes, and snippets.

using System.Text.RegularExpressions;
var client = new HttpClient();
var response = await client.GetStringAsync("https://www.cloudflare.com/cdn-cgi/trace");
var tls = Regex.Match(response, @"(?<=tls=).*").Value;
Console.WriteLine(tls);
@almog-barel
almog-barel / replicationStatus.sql
Last active July 28, 2023 09:36
postgres get replication status
select case WHEN EXISTS (SELECT * FROM pg_stat_replication) THEN (SELECT CASE WHEN state = 'streaming' THEN true ELSE false END FROM pg_stat_replication LIMIT 1) WHEN pg_is_in_recovery() THEN (SELECT CASE WHEN status = 'streaming' THEN true ELSE false END FROM pg_stat_wal_receiver LIMIT 1) ELSE true END;
@almog-barel
almog-barel / publishContainerstatus.sh
Created July 28, 2023 09:27
publish all docker container status to push gateway
docker ps -a --format "{{.Names}} {{if eq .State \"running\"}}1{{else}}0{{end}}" | sed 's/-/_/g' | while read line; do echo "$line" | curl --data-binary @- http://localhost:9091/metrics/job/container_status/instance/localhost; done