Timeout may be necessary if the delition of an item cannot be garanted.
Call example:
EVAL f572d396fae9206628714fb2ce00f72e94f2258f 2 wip_key evict_key itemVal <now + timeout> wip_limit evictPeriodSec now
Timeout may be necessary if the delition of an item cannot be garanted.
Call example:
EVAL f572d396fae9206628714fb2ce00f72e94f2258f 2 wip_key evict_key itemVal <now + timeout> wip_limit evictPeriodSec now
This tool can read current or change default HCI_LE_AUTOCONN_TIMEOUT value for Bluetooth adapter on Linux. The default value is defined for the kernel 5.15 at include/net/bluetooth/hci.h:
#define HCI_LE_AUTOCONN_TIMEOUT msecs_to_jiffies(4000) /* 4 seconds */and it can be too low if the advertising interval for a device is high (for power saving).
You can also change the value in /etc/bluetooth/main.conf, line LEAutoconnecttimeout. The value in ms and will be applied at boot or when bluetooth service is restarted.
The tool changes timeout to hardcoded value 16000ms. You can change value NEW_LE_AUTOCONN_TIMEOUT in the lower source file to required value .
| apt install flex bison | |
| git clone https://github.com/microsoft/WSL2-Linux-Kernel --depth 1 | |
| cd WSL2-Linux-Kernel/tools/perf | |
| make -j8 | |
| sudo cp perf /usr/local/bin |
Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.
There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.
struct foo {
struct bar {
int x;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.
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |