Skip to content

Instantly share code, notes, and snippets.

import java.time.Duration;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.IntStream;
import java.util.stream.Stream;
/**
* Demonstrate potential for deadlock on a {@link ReentrantLock} when there is both a synchronized and
* non-synchronized path to that lock, which can allow a virtual thread to hold the lock, but
* other pinned waiters to consume all the available workers.
@JonCole
JonCole / Redis-BestPractices-General.md
Last active October 29, 2024 17:54
Redis Best Practices

Some of the Redis best practices content has moved

This content from this markdown file has moved a new, happier home where it can serve more people. Please check it out : https://docs.microsoft.com/azure/azure-cache-for-redis/cache-best-practices.

NOTE: Client specific guidance listed below is still valid and should still be considered. I will update this document once all content has been moved.

@subfuzion
subfuzion / curl.md
Last active November 17, 2024 03:54
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@csamsel
csamsel / Enhanced NGINX logstash parser
Last active February 5, 2022 14:54
Enhanced NGINX logstash parser to include upstream response time and request length fields
Enhanced NGINX logstash parser:
NGINX log format:
log_format enhanced '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $request_length "$http_referer" "$http_user_agent" $request_time $upstream_response_time';
access_log /var/log/nginx/access.log enhanced;
error_log /var/log/nginx/error.log;
logstash pattern (/opt/logstash/pattern/nginx):
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active November 18, 2024 03:05
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@sirupsen
sirupsen / gist:6479740
Last active April 5, 2019 16:28
Implementation of a trie in Ruby.
class Trie
attr_accessor :word, :trie
def initialize
@trie = {}
@word = false
end
def <<(string)
node = string.each_char.inject(self) { |node, char| node.trie[char] ||= Trie.new }