I hereby claim:
- I am jrc03c on github.
- I am jrc03c (https://keybase.io/jrc03c) on keybase.
- I have a public key whose fingerprint is 1033 6973 7373 5FD5 7AE9 5114 ED23 C1F4 B19A C886
To claim this, I am signing this object:
const express = require("express") | |
const fs = require("fs") | |
const http = require("http") | |
const https = require("https") | |
// create a basic HTTP app that just redirects requests from HTTP to HTTPS | |
const httpApp = express() | |
httpApp.use((request, response) => { | |
return response.redirect("https://" + request.hostname + request.url) |
// Note that this uses the __dirname definition from here: | |
// https://gist.github.com/jrc03c/6fbccd5af3a4d1b61f12e1e620e1c01b | |
import { defineConfig } from "vite" | |
import path from "path" | |
const __dirname = path.resolve( | |
import.meta.url.replace("file://", "").split("/").slice(0, -1).join("/") | |
) |
const __dirname = path.resolve( | |
import.meta.url.replace("file://", "").split("/").slice(0, -1).join("/") | |
) |
I hereby claim:
To claim this, I am signing this object:
# from: https://stackoverflow.com/a/4630407 | |
rsync -rvz -e "ssh -p <PORT>" --progress /source/path user@host:/target/path |
# assuming a partition already exists, apply LUKS formatting to it | |
sudo cryptsetup luksFormat /dev/whatever | |
# open it | |
sudo cryptsetup luksOpen /dev/whatever mapping_name | |
# format it to ext4 (or whatever) | |
sudo mkfs.ext4 /dev/mapper/mapping_name | |
# mount it |
// from: https://davidwalsh.name/detect-scrollbar-width | |
function getScrollbarWidth() { | |
const div = document.createElement("div") | |
div.style = ` | |
width: 100px; | |
height: 100px; | |
overflow: scroll; | |
position: absolute; |
// 🚨 🚨 🚨 | |
// NOTE: According to MDN, `document.execCommand()` is deprecated. See: | |
// https://developer.mozilla.org/en-US/docs/Web/API/document/execCommand | |
// Instead, use the Clipboard API: | |
// https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API | |
// 🚨 🚨 🚨 | |
function copy(text) { | |
const input = document.createElement("input") | |
input.type = "text" |
function createHighDPICanvas(width, height){ | |
let dpi = window.devicePixelRatio || 1 | |
let canvas = document.createElement("canvas") | |
canvas.width = width * dpi | |
canvas.height = height * dpi | |
canvas.style.width = width + "px" | |
canvas.style.height = height + "px" | |
canvas.getContext("2d").scale(dpi, dpi) | |
return canvas | |
} |