Skip to content

Instantly share code, notes, and snippets.

View marta-krzyk-dev's full-sized avatar
Focusing

Marta Krzyk marta-krzyk-dev

Focusing
View GitHub Profile
@stokito
stokito / cert-gen.sh
Last active October 26, 2023 07:55
Generate self signed cert with ECC elyptic curve and wildcard domain
# You can use smaller curve prime256v1
openssl req -x509 -new -newkey ec -pkeyopt ec_paramgen_curve:secp384r1 -days 3650 -noenc -keyout example.com.privkey.p8 -out example.com.cer -subj "/CN=example.com" -addext "subjectAltName=DNS:example.com,DNS:*.example.com"
@Atinux
Atinux / async-foreach.js
Last active October 10, 2023 03:04
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
@max-mapper
max-mapper / index.sh
Last active November 2, 2023 10:13
generate ES512 and RS256 elliptic curve keypairs for JWT JWK (JSON Web Token JSON Web Key) using openssl
# RS256
# private key
openssl genrsa -out rs256-4096-private.rsa 4096
# public key
openssl rsa -in rs256-4096-private.rsa -pubout > rs256-4096-public.pem
# ES512
# private key
openssl ecparam -genkey -name secp521r1 -noout -out ecdsa-p521-private.pem
# public key
@tsaarni
tsaarni / openssl-notes.txt
Created October 22, 2016 08:50
Generate self-signed certs with different key types
*** RSA
# Generate self-signed certificate with RSA 4096 key-pair
openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout rsakey.pem -out rsacert.pem
# print private and public key
openssl rsa -in rsakey.pem -text -noout
# print certificate
openssl x509 -in rsacert.pem -text -noout
@vasanthk
vasanthk / System Design.md
Last active May 6, 2024 20:21
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@dkalamari
dkalamari / gist:5712953
Last active September 27, 2023 13:46
WPF Binding form close event to viewmodel command
<Window x:Class="App.WPF.Windows.DocumentDetailsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" WindowStartupLocation="CenterScreen"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
Title="Document Details" Height="700" Width="700">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Closing">
<i:InvokeCommandAction Command="{Binding CloseCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>