Skip to content

Instantly share code, notes, and snippets.

Avatar

Janos Krnak jkrnak

  • Budapest, Hungary
View GitHub Profile
@jkrnak
jkrnak / xps_15_9570__dualboot_with_encryption__notes.md
Created Jun 15, 2019 — forked from mdziekon/xps_15_9570__dualboot_with_encryption__notes.md
XPS 15 9570 - DualBoot with Encryption (Windows 10 with BitLocker + Ubuntu 18.04 with LVM on LUKS)
View xps_15_9570__dualboot_with_encryption__notes.md
  • Based on https://askubuntu.com/a/293029/286776
  • Installation date: 15-09-2018
  • Additional notes based on my own experience
  • The process describes a completely fresh installation with a complete repartitioning, however it should work fine when Windows is already installed (eg. brand new machine with Windows preinstalled).
  • The process was conducted on Dell's XPS 15 9570 (2018) with specs:
    • CPU: i7-8750H
    • Screen: 4K with Touch
    • RAM: 16 GB (original) / 32 GB (manually upgraded)
    • Drive: 512 GB (SK Hynix PC401)
@jkrnak
jkrnak / dotenv.tmpl
Last active Dec 16, 2018
Confd example
View dotenv.tmpl
# /etc/confd/templates/dotenv.tmpl
PASSWORD={{getv "/client-api/database/password"}}
USER={{getv "/client-api/database/user"}}
MAPS_API_KEY={{getv "/client-api/maps/api/key"}}
@jkrnak
jkrnak / serverless.yml
Created Nov 21, 2018
Create Lambda@Edge project
View serverless.yml
service: LambdaAtEdge
provider:
name: aws
runtime: nodejs8.10
region: us-east-1
resources:
Resources:
LambdaAtEdgeRole:
@jkrnak
jkrnak / log-policy.json
Last active Nov 21, 2018
Allow full access to logs
View log-policy.json
{
"Version": "2012-10-17",
"Statement": [ {
"Action": ["logs:*"],
"Effect": "Allow",
"Resource": "*"
} ]
}
@jkrnak
jkrnak / trust-policy.json
Last active Nov 21, 2018
Trust policy for Lambda@Edge
View trust-policy.json
{
"Version": "2012-10-17",
"Statement": [ {
"Effect": "Allow",
"Principal": {
"Service": ["lambda.amazonaws.com", "edgelambda.amazonaws.com" ]
},
"Action": "sts:AssumeRole"
} ]
}
@jkrnak
jkrnak / handler.js
Last active Apr 6, 2021
Example Lambda@Edge function to add cache control header to assets
View handler.js
// Lambda function to set cache control public header in case of missing cache control header
exports.handler = (event, context, callback) => {
const { response } = event.Records[0].cf;
const { headers } = response;
const headerCacheControl = 'Cache-Control';
const defaultTimeToLive = 60 * 60 * 24 * 14; // 14 days
if (response.status === '200') {
if (!headers[headerCacheControl.toLowerCase()]) {
@jkrnak
jkrnak / example CORS response
Last active Sep 14, 2018
example CORS response to allow www.example.com to access resources on the server
View example CORS response
< HTTP/2 200
< access-control-allow-methods: GET, PUT, POST, DELETE
< access-control-allow-origin: www.example.com