Skip to content

Instantly share code, notes, and snippets.

@staticpix
staticpix / hibernate-cheatsheet.java
Created December 8, 2020 18:09 — forked from jahe/hibernate-cheatsheet.java
Hibernate Cheatsheet
// Performance of entity relations
https://vladmihalcea.com/2016/06/28/14-high-performance-java-persistence-tips/
// Using UUIDs as primary key
// (This uses the default UUID version 4 (random) strategy according to IETF RFC 4122 rather than version 1 (time-based) strategy)
@Entity(name = "Book")
public class Book {
@Id
@GeneratedValue
@staticpix
staticpix / git-cheatsheet.sh
Created December 8, 2020 18:09 — forked from jahe/git-cheatsheet.sh
Git Cheatsheet
# Show status of current changes
git status
# Checkout pull request from GitHub
git fetch origin pull/<id>/head:<local-branchname-for-pr>
git checkout <local-branchname-for-pr>
# Pull latest changes from pull request from GitHub
git pull origin pull/<id>/head:<remote-branchname-for-pr>
@staticpix
staticpix / http-caching-cheatsheet.sh
Created December 8, 2020 18:09 — forked from jahe/http-caching-cheatsheet.sh
HTTP Caching Cheatsheet
# Cache related HTTP headers should be on the server response.
# Cache file but ask the server on every request if there is a new version of it.
# Mainly used for mutable files such as a bundled app.js or a styles.css file.
# Set the following HTTP headers on the response:
Cache-Control: no-cache
# no-cache means: check whether there is a new version of the file on every request.
# If the cached version is up to date take it. If it's not, fetch the new one.
# To check whether there is a new version of a file
@staticpix
staticpix / cloud-native-java-talk-notes.md
Created December 8, 2020 18:08 — forked from jahe/cloud-native-java-talk-notes.md
Notes on the talk "Cloud Native Java" by Josh Long
@staticpix
staticpix / docker-birthday-4-workshop-notes.sh
Created December 8, 2020 18:08 — forked from jahe/docker-birthday-4-workshop-notes.sh
Docker Birthday #4 Celebration - Workshop Notes @kartenmacherei GmbH
# The pull command fetches the alpine image from the Docker registry and saves it in our system.
docker image pull alpine
# You can use the docker image command to see a list of all images on your system.
docker image ls
# Run a Docker container based on this image. To do that you are going to use the docker container run command.
# When you call run, the Docker client finds the image (alpine in this case),
# creates the container and then runs a command in that container.
docker container run alpine ls -l
@staticpix
staticpix / jdbc-cheatsheet.sh
Created December 8, 2020 18:08 — forked from jahe/jdbc-cheatsheet.sh
JDBC Cheatsheet
# --- Oracle DB ---
# URL - Old syntax
jdbc:oracle:thin:@[HOST][:PORT]:SID
# URL - New syntax
jdbc:oracle:thin:@//[HOST][:PORT]/SERVICE
# driver-class-name
oracle.jdbc.driver.OracleDriver
# --- PostgreSQL ---
# URL
@staticpix
staticpix / jwt-notes.txt
Created December 8, 2020 18:08 — forked from jahe/jwt-notes.txt
JWT Notes
JSON Web Token
Client - Sends requests to the Server
Server - Doesn't trust a Clients request unless it is authenticated
On Login with Username + Password the Server creates a JWT which is
returned to the Client.
The Client has to store the Token and send it along with any upcoming
request.
@staticpix
staticpix / oauth-cheetsheet.txt
Created December 8, 2020 18:08 — forked from jahe/oauth-cheetsheet.txt
OAuth Cheatsheet
OAuth (Open Authentication)
OAuth Client - e.g. My Server
OAuth Provider - e.g. Facebook Server
1. Register the OAuth Client on the OAuth Provider
2. It gets back an Client ID and a Client Secret
(On FB you do this manually by creating a developer account)
3. We want to authorize a user via the OAuth Provider
We send to "GET: provider.com/oauth/authorize?" with
@staticpix
staticpix / jpa-cheatsheet.java
Created December 8, 2020 18:08 — forked from jahe/jpa-cheatsheet.java
JPA Cheatsheet
/*
JPA (Java Persistence API)
Transaction Management with an Entity-Mananger:
---
entityManager.getTransaction().begin();
entityManager.persist(<some-entity>);
entityManager.getTransaction().commit();
entityManager.clear();
@staticpix
staticpix / sonarqube-cheatsheet.txt
Created December 8, 2020 18:07 — forked from jahe/sonarqube-cheatsheet.txt
SonarQube Cheatsheet
# Exclude files or directories from duplication check
sonar.cpd.exclusions=**/AssemblyInfo.cs,**/*.g.cs,**/Mappings/*.cs