duplicates = multiple editions
A Classical Introduction to Modern Number Theory,Kenneth IrelandMichael Rosen
A Classical Introduction to Modern Number Theory,Kenneth IrelandMichael Rosen
import java.util.ArrayList; | |
import java.util.Date; | |
import java.util.List; | |
import org.apache.log4j.spi.LoggingEvent; | |
public class CachingSingletonAppender { | |
private static final CachingSingletonAppender theInstance = new CachingSingletonAppender(); | |
private List<LogEventListener> listeners; | |
private List<LogEvent> eventCache; |
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
Place the service file (or a link to it) in /etc/systemd/system/ Place the watchdogged.py file somewhere ( and change the ExecStart portion in the .service to point at the file )
then do systemctl daemon-reload
followed by systemctl start watchdogged.service
After this you can watch the progress using journalctl --follow -u watchdogged.service
change the PROBABILITY variable to something else to watch it faster/later or succeed.
license: gpl-3.0 |
package main | |
import ( | |
"fmt" | |
"github.com/prometheus/client_golang/prometheus" | |
"github.com/prometheus/client_golang/prometheus/promhttp" | |
"io/ioutil" | |
"log" | |
"math/rand" | |
"net/http" |
create a slackbot to fetch text events from an internal api and send it to a dedicated slack channel
slack bot api can be found from:
https://slack.dev/python-slack-sdk/web/index.html#messaging
our internal api has two endpoints:
create a slackbot to fetch text events from an internal api and send it to a dedicated slack channel
slack bot api can be found from:
https://slack.dev/python-slack-sdk/web/index.html#messaging
our internal api has two endpoints:
Rgate is a simple API Gateway which routes HTTP traffic to configured upstreams.
For example, given the below config:
rgate:
routes:
- path_prefix: /public-api/posts
backend: https://gorest.co.in
default_response:
body: "This is not reachable"