Skip to content

Instantly share code, notes, and snippets.

@jahe
jahe / spring-boot-cheatsheet.java
Last active May 16, 2024 07:44
Spring Boot Cheatsheet
// Enable component-scanning and auto-configuration with @SpringBootApplication Annotation
// It combines @Configuration + @ComponentScan + @EnableAutoConfiguration
@SpringBootApplication
public class FooApplication {
public static void main(String[] args) {
// Bootstrap the application
SpringApplication.run(FooApplication.class, args);
}
}

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@reinaldons
reinaldons / Makefile
Last active June 15, 2020 13:47
Flask + uWSGI + Nginx
PID_FILE = '/tmp/flask_test_uwsgi.pid'
LOG_FILE = '/tmp/flask_test_uwsgi.log'
up:
uwsgi --ini uwsgi.ini --wsgi-file app.py --pidfile $(PID_FILE) --logto $(LOG_FILE) &
down:
uwsgi --stop $(PID_FILE)