Skip to content

Instantly share code, notes, and snippets.

View epiphone's full-sized avatar

Aleksi Pekkala epiphone

  • Seoul, South Korea
View GitHub Profile

How we incorporate next and cloudfront (2018-04-21)

Feel free to contact me at [email protected] or tweet at me @statisticsftw

This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!

It assumes some knowledge of AWS.

Goals

@imevro
imevro / index.html
Last active March 22, 2020 19:22
Minimally working version of SSR (react, react-router, react-helmet, styled-components; implying use of react-scripts without eject)
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="$helmet-placeholder$">
<meta name="$sc-placeholder$">
<style>
@conan
conan / url-gen.clj
Created October 4, 2017 14:13
Clojure.spec URL and email specs with generators
(require '[cemerick.url :as url]
'[clojure.spec.alpha :as s]
'[clojure.spec.gen.alpha :as gen]
'[clojure.string :as string])
(def non-empty-string-alphanumeric
"Generator for non-empty alphanumeric strings"
(gen/such-that #(not= "" %)
(gen/string-alphanumeric)))
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active June 28, 2025 20:00
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@ahmetb
ahmetb / gcrgc.sh
Last active March 10, 2025 21:51
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@zacharycarter
zacharycarter / wclwn.md
Last active May 22, 2025 15:00
Binding to C Libraries with Nim
@chrisveness
chrisveness / crypto-aes-gcm.js
Last active May 11, 2025 11:17
Uses the SubtleCrypto interface of the Web Cryptography API to encrypt and decrypt text using AES-GCM (AES Galois counter mode).
/**
* Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt().
* (c) Chris Veness MIT Licence
*
* @param {String} plaintext - Plaintext to be encrypted.
* @param {String} password - Password to use to encrypt plaintext.
* @returns {String} Encrypted ciphertext.
*
* @example
* const ciphertext = await aesGcmEncrypt('my secret text', 'pw');
@armand1m
armand1m / Dockerfile
Last active May 27, 2025 10:33
Yarn cache compatible Dockerfile
FROM alpine
RUN apk add --update --no-cache nodejs
RUN npm i -g yarn
ADD package.json yarn.lock /tmp/
ADD .yarn-cache.tgz /
RUN cd /tmp && yarn
RUN mkdir -p /service && cd /service && ln -s /tmp/node_modules
@peterhurford
peterhurford / pytest-fixture-modularization.md
Created July 28, 2016 15:48
How to modularize your py.test fixtures

Using py.test is great and the support for test fixtures is pretty awesome. However, in order to share your fixtures across your entire module, py.test suggests you define all your fixtures within one single conftest.py file. This is impractical if you have a large quantity of fixtures -- for better organization and readibility, you would much rather define your fixtures across multiple, well-named files. But how do you do that? ...No one on the internet seemed to know.

Turns out, however, you can define fixtures in individual files like this:

tests/fixtures/add.py

import pytest

@pytest.fixture
@pahud
pahud / aws-get-credentials.js
Last active November 21, 2022 16:51
AWS CredentialProviderChain example in aws-sdk of NodeJS
'use strict';
var AWS = require('aws-sdk');
//var P = require('bluebird');
var aws_region = process.env['AWS_REGION'] ? process.env['AWS_REGION'] : 'us-west-2'
var aws_profile = process.env['AWS_PROFILE'] ? process.env['AWS_PROFILE'] : 'default'
AWS.CredentialProviderChain.defaultProviders = [