Skip to content

Instantly share code, notes, and snippets.

View geoand's full-sized avatar

Georgios Andrianakis geoand

View GitHub Profile
@jboner
jboner / latency.txt
Last active May 3, 2024 15:17
Latency Numbers Every Programmer Should Know
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
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

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

@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 30, 2024 23:36
how to delete a git tag locally and remote
# 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
@rgl
rgl / wait_for_http_200.sh
Last active March 7, 2024 17:08
Wait for an HTTP endpoint to return 200 OK with Bash and curl
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
@cy6erGn0m
cy6erGn0m / merge-maps.kt
Created May 20, 2015 14:41
Merge two maps with custom reduce function for Kotlin
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 {
@oza
oza / SparkOnYARN.md
Last active October 9, 2022 08:53
How to run Spark on YARN with dynamic resource allocation

YARN

  1. General resource management layer on HDFS
  2. A part of Hadoop

Spark

  1. In memory processing framework

Spark on YARN

@jeffsheets
jeffsheets / ApiSecurityConfig.groovy
Created September 6, 2017 16:33
Spock Test for Spring Boot Security configuration - showing basic simple examples for unauthenticated users, role based access, and httpBasic logins
@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) {
@fitzoh
fitzoh / SpringCloudGatewayApplication.java
Created September 7, 2017 01:24
Canary deploys with spring-cloud-gateway (2.0.0-M1)
@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
@thomasdarimont
thomasdarimont / readme.md
Created February 23, 2018 09:21
Wait for HTTP Service to become available with timeout (bash)
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.