(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
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 |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
# delete local tag '12345' | |
git tag -d 12345 | |
# delete remote tag '12345' (eg, GitHub version too) | |
git push origin :refs/tags/12345 | |
# alternative approach | |
git push --delete origin tagName | |
git tag -d tagName |
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done' | |
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76 |
private fun <K, V> Map<K, V>.mergeReduce(other: Map<K, V>, reduce: (V, V) -> V = { a, b -> b }): Map<K, V> { | |
val result = LinkedHashMap<K, V>(this.size() + other.size()) | |
result.putAll(this) | |
other.forEach { e -> | |
val existing = result[e.key] | |
if (existing == null) { | |
result[e.key] = e.value | |
} | |
else { |
@EnableWebSecurity | |
class ApiSecurityConfig extends WebSecurityConfigurerAdapter { | |
@Inject | |
void configureGlobal(AuthenticationManagerBuilder auth) { | |
auth.inMemoryAuthentication() | |
.withUser('svc_acct').password('somePassword').roles('FULL_ACCESS') | |
} | |
@Override | |
protected void configure(HttpSecurity http) { |
@EnableGateway | |
@SpringBootApplication | |
public class SpringCloudGatewayApplication { | |
private final String cookieName = "beta_active"; | |
private final String headerName = "X-Beta-active"; | |
private final String betaActiveValue = "true"; | |
/** | |
* They're in the beta if they have a cookie or request header set |
timeout 40s /bin/bash -c "while ! httping -qc1 http://somehost:8080/app ; do sleep 1 ; done; echo OK" || echo TIMEOUT
If the service cannot be reached within 40s then TIMEOUT will be printed otherwise OK.