Skip to content

Instantly share code, notes, and snippets.

View jahe's full-sized avatar

Jannik Hell jahe

View GitHub Profile
@jahe
jahe / postgresql-cheatsheet.sql
Last active September 3, 2025 14:32
PostgreSQL Cheatsheet
-- Set a Sequence to a specific value
select setval('address_seq', 1, true);
-- Show last used sequence value
SELECT last_value FROM my_sequence_name;
-- Show text from a TEXT datatype column: http://www.solewing.org/blog/2015/08/hibernate-postgresql-and-lob-string/
SELECT
convert_from(loread(
lo_open(my_large_text::int, x'40000'::int), x'40000'::int), 'UTF-8'
@jahe
jahe / intellij-idea-cheatsheet.txt
Last active December 8, 2020 18:07
IntelliJ IDEA Cheatsheet
# Show a preview of the selected method/class: "Quick Definition Lookup"
Ctrl + Shift + I
# Switch to another open tab
Ctrl + Tab
# Close a specific tab within this Switcher (Ctrl + Tab)
Choose tab in Switcher > Backspace or Delete
# Evaluate Expression (in a dialog)
@jahe
jahe / oracle-db-cheatsheet.sql
Last active January 29, 2021 18:50
Oracle DB Cheatsheet
-- Current Date as Timestamp
CURRENT_TIMESTAMP
-- Current Date as Date
SYSDATE
-- Insert multiple rows
insert into countries select rownum, 'Name'||rownum from dual connect by rownum <= 1000000;
-- Delete all rows from a table
@jahe
jahe / spring-cloud-netflix-stack.md
Last active December 8, 2020 18:07
Spring Cloud Netflix Stack

Spring Cloud - "Umbrella Project" which consists of multiple frameworks

  • Spring Cloud Connectors - Connectors to PAAS services to scale new nodes
    • Heroku
    • Cloud Foundry
  • Spring Cloud Bus - Event Bus (message queue)
  • Spring Cloud Netflix (= Spring Cloud Netflix Stack) - The central part of the application consists of multiple components (Provided by Netflix)
    • Archaius - Centalized configuration (like Spring Cloud Config but with Netflix technology)
    • Zuul - Proxy server with virtual paths each pointing to a specifc service which can be executed in multiple instances: Central Path Configuration so that the user doesn't recognize changes
  • Hystrix - Resilience Framework (Used with Ribbon + Feign where Hystrix is the core): A Switch that points to another instance (or throws an error when no other instance is available) when the requested instance throws an error and pauses requests to the requested instance for an amount of time (prevents deadlocks or unlimited
@jahe
jahe / sonarqube-cheatsheet.txt
Created May 17, 2017 09:30
SonarQube Cheatsheet
# Exclude files or directories from duplication check
sonar.cpd.exclusions=**/AssemblyInfo.cs,**/*.g.cs,**/Mappings/*.cs
@jahe
jahe / jpa-cheatsheet.java
Last active September 3, 2025 14:31
JPA Cheatsheet
/*
JPA (Java Persistence API)
Transaction Management with an Entity-Mananger:
---
entityManager.getTransaction().begin();
entityManager.persist(<some-entity>);
entityManager.getTransaction().commit();
entityManager.clear();
@jahe
jahe / oauth-cheetsheet.txt
Last active December 8, 2020 18:08
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
@jahe
jahe / jwt-notes.txt
Created May 12, 2017 20:31
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.
@jahe
jahe / jms-cheatsheet.java
Last active May 30, 2017 08:58
JMS Cheatsheet
Java Messaging - JMS 2.0
JMS - Interface to send messages
Message - Usually text or bytes
Producer - Creates messages
Consumer - Receives messages
Destination - Sits between the Producer an the Consumer
There are two types of Destinations:
1. Queue - Message can be received by only one Consumer (First come first serve)
2. Topic - Message can be received by any Consumers listening
@jahe
jahe / kafka-notes.txt
Created May 12, 2017 19:30
Kafka Notes
Producer - Publishes data on a specific topic into the Kafka Cluster
Consumer - Consumes data from a specific topic
Broker - One Node in the Kafka Cluster which is responsible for specific topics
Kafka Cluster - Multiple machines running Kafka
Topic - Subject where Producers + Consumers can communicate on
Commit Log - Messages stored in a broker identified by an ID
Retention Policy - What to do in case of lacking storage:
1. Remove some old ones
2. Remove the old versions of messages and only leave the latest versions of the messages