Skip to content

Instantly share code, notes, and snippets.

View hamburghammer's full-sized avatar
🚀

Augusto Dwenger J. hamburghammer

🚀
View GitHub Profile
@hamburghammer
hamburghammer / ImmutableCacheExample.java
Created November 7, 2019 14:27
Cache stuff immutable in an Java object
public final class Foo {
private final int a;
private final int b;
//Immutabel cache even without final because it's the result of final/immutable data
private int calculateCache; //init = 0
public Foo(int a, int b) {
this.a = a;
this.b = b;
@hamburghammer
hamburghammer / BuilderFactoryExample.java
Last active November 7, 2019 15:23
Java Factory Pattern Example
public final class Main {
public static void main(String[...] args) {
Bar s = new Bar.Builder(new Object())
.withObject1(new Object())
.withObject2(new Object())
.withString("s").build();
Bar build = Bar.builder(new Object()).build();
}
@hamburghammer
hamburghammer / add_CA_on_linux.md
Last active December 8, 2023 08:43 — forked from kekru/add CA cert on CentOS Debian Ubuntu.md
Add CA cert to local trust store on CentOS, Manjaro, Debian or Ubuntu
  • Open a webpage that uses the CA with Firefox
  • Click the lock-icon in the addressbar -> show information -> show certificate
  • the certificate viewer will open
  • click details and choose the certificate of the certificate-chain, you want to import to CentOS
  • click "Export..." and save it as .crt file
  • Copy the .crt file to /etc/pki/ca-trust/source/anchors on your CentOS machine
  • run update-ca-trust extract
  • test it with wget https://example.com

On Manjaro (arch) the location for the certificates is: /usr/share/ca-certificates/trust-source/anchors (low priority) or /etc/ca-certificates/trust-source/anchors/ (high priority) and the command to update is update-ca-trust extract.