Skip to content

Instantly share code, notes, and snippets.

View jahe's full-sized avatar

Jannik Hell jahe

View GitHub Profile
@jahe
jahe / psql-cheatsheet.sh
Last active April 1, 2024 18:52
psql Cheatsheet
# Start psql
> psql
<current-database>=#
# Exit psql
\q
# Show all tables
\dt
@jahe
jahe / web-application-best-practices.md
Last active March 21, 2021 21:16
Web Application - Best Practices
@jahe
jahe / graphql-cheatsheet.md
Last active August 4, 2020 14:04
GraphQL Cheatsheet

Essential quotes

  • "GraphQL is about asking for specific fields on objects"
  • "The query has exactly the same shape as the result"
  • "Clients can fetch lots of related data in one request, instead of making several roundtrips in a classic REST architecture"
  • "GraphQL queries look the same for both single items or lists of items"
  • "In REST, you can only pass a single set of arguments but in GraphQL, every field and nested object can get its own set of arguments, making GraphQL a complete replacement for making multiple API fetches"
  • "While query fields are executed in parallel, mutation fields run in series, one after the other"

Glossary

  • Type
@jahe
jahe / go-cheatsheet.go
Last active June 15, 2020 08:18
Go Cheatsheet
// Simple function
func add(x int, y int) int {
return x + y
}
// Function that returns 2 values
func swap(x string, y string) (string, string) {
return y, x
}
@jahe
jahe / typescript-cheatsheet.ts
Last active June 15, 2021 23:44
TypeScript Cheatsheet
// Activate the family of strict options
// You can then selectively opt out with specific strict options set to false
--strict
// Properties in ES6 classes should be initialized
//
// It checks weather one of the following conditions evaluatest to true:
// * has a type that includes undefined
// * has an explicit initializer
// * is definitely assigned to in the constructor
@jahe
jahe / aws-ecs-cheatsheet.md
Created December 20, 2018 10:16
AWS ECS Cheatsheet

Container Definition within Task Definition

memory and memoryReservation - The memory setting is a hard limit. If the containers memory usage hits this amount, the container will be terminated. If on the other hand, you specify memoryReservation, that much memory will be reserved for the task, but it can use more, up to the total amount of the machine. Only one of memory and memoryReservation are required. If both are used, memoryReservation should be less than memory. If you are only going to specify one of these, I'd recommend memoryReservation, as it will allow your task to use up to the total memory on the machine.

@jahe
jahe / python-cheatsheet.py
Last active June 15, 2020 08:21
Python Cheatsheet
# All values are considered "truthy" except for the following, which are "falsy":
None
False
0
0.0
0j
Decimal(0)
Fraction(0, 1)
[] - an empty list
@jahe
jahe / svg-cheatsheet.svg
Created October 3, 2018 11:40
SVG Cheatsheet
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jahe
jahe / key-and-password-generation-cheatsheet.sh
Created September 27, 2018 09:58
Key / Password Generation Cheatsheet
# Generate a safe password with node.js
node -e "console.log(require('crypto').randomBytes(256).toString('base64'));"
@jahe
jahe / resilient-software-design.md
Created August 18, 2018 10:46
Resilient Software Design

Fehlerszenarien

  • Nutzer bekommt nichts davon mit (bester Fall)
  • Anwendung läuft in einem definierten, reduzierten Service-Level weiter

Ziele von Software, damit sie einen Geschäftswert erzielt

  • Muss in Produktion laufen
  • Muss ordnungsgemäß funktionieren (Verfügbarkeit)

Verfügbarkeit = MTTF / (MTTF + MTTR)