Skip to content

Instantly share code, notes, and snippets.

View 524c's full-sized avatar

Roger Lucas 524c

View GitHub Profile
@danpetitt
danpetitt / esmodules.md
Last active April 21, 2024 21:23
Typescript, Jest and ECMAScript Modules

Typescript, Jest and ECMAScript Modules (ESM)

Package.json

Add the type property to package.json to ensure modules are supported:

{
  "type": "module",
}
@aradalvand
aradalvand / DockerfileForSvelteKit.md
Last active May 7, 2024 16:44
Dockerfile and .dockerignore for SvelteKit:

*This Dockerfile is intended for SvelteKit applications that use adapter-node. So, the Dockerfile below assumes that you have already installed and configured the adapter.

Dockerfile:

FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json .
RUN npm ci
COPY . .
RUN npm run build
// Core assets
let coreAssets = [];
// On install, cache core assets
self.addEventListener('install', function (event) {
// Cache core assets
event.waitUntil(caches.open('app').then(function (cache) {
for (let asset of coreAssets) {
cache.add(new Request(asset));
@jakexks
jakexks / cert-manager-test.sh
Last active January 15, 2024 09:23
Cert-manager selfsigned as cluster issuer
#!/usr/bin/env bash
set -ex
export TEST_CLUSTER_NAME=quick-test
export CERT_MANAGER_VERSION=v1.3.1
export KIND_IMAGE=kindest/node:v1.20.2
# Create test cluster
echo "Creating test cluster..."
kind create cluster --name="$TEST_CLUSTER_NAME" --image="$KIND_IMAGE"
until kubectl --timeout=120s wait --for=condition=Ready pods --all --namespace kube-system; do sleep 1; done
@acoyfellow
acoyfellow / hooks.js
Last active February 12, 2023 01:22
hooks.js CSP example
// https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
// https://scotthelme.co.uk/content-security-policy-an-introduction/
// scanner: https://securityheaders.com/
const rootDomain = `your-domain.com`; // or your server IP for dev
const directives = {
'img-src': [
"*",
"'self'",
@sttk
sttk / javascript-prototype-pollution.md
Last active April 7, 2023 15:13
Javascript Prototype Pollution

Javascript Prototype Pollution

Javascript prototype specification

// Not only Object but also other types. (Function, Array, String, Number, ...)
Object.prototype.prop1 = 1;
Object.prototype.func1 = () => 'Hello!';                                        

const obj1 = {};
@lucaguada
lucaguada / RASPBERRY_PI_4.md
Last active April 4, 2024 07:19
Steps to fully install Ubuntu Server and MiniKube on Raspberry Pi 4 (wip)

How to install Ubuntu Server and Minikube on Raspberry Pi 4 4GB+ (recommended)

Disclaimer: this step-by-step GIST has been created with no guarantees, I may have missed some steps because of distraction or chiptune improvised on-chair-dancing, so be patient and let me know if I must add or fix something.

This is the way for living long and prospering!

Download Raspberry Pi Imager

Download and install Raspberry Imager: https://www.raspberrypi.org/software/

@ilmoralito
ilmoralito / mime.html
Created November 8, 2020 06:13 — forked from topalex/mime.html
How to check real mime type of image in javascript
<html>
<head>
<script type="text/javascript" src="/jquery.min.js"></script>
<title>Mime type checker</title>
<script>
$(function () {
var result = $('div#result');
if (window.FileReader && window.Blob) {
$('span#submit').click(function () {
var files = $('input#file').get(0).files;
@tcdowney
tcdowney / ubuntu-sleep.yaml
Created June 27, 2020 00:54
Ubuntu Sleep Pod
apiVersion: v1
kind: Pod
metadata:
name: ubuntu
labels:
app: ubuntu
spec:
containers:
- image: ubuntu
command: