Description | Code |
---|---|
Reset | \x1b[0m |
Bright | \x1b[1m |
Dim | \x1b[2m |
Underscore | \x1b[4m |
Blink | \x1b[5m |
Reverse | \x1b[7m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from: https://stackoverflow.com/a/4630407 | |
rsync -rvz -e "ssh -p <PORT>" --progress /source/path user@host:/target/path |
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:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const __dirname = path.resolve( | |
import.meta.url.replace("file://", "").split("/").slice(0, -1).join("/") | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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("/") | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { watch } from "@jrc03c/watch" | |
import process from "node:process" | |
function rebuild() { | |
console.log("-----") | |
console.log(`Rebuilding... (${new Date().toLocaleString()})`) | |
try { | |
// do stuff... | |
console.log("Done! 🎉") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ABOVE = "above" | |
const BELOW = "below" | |
const EXACTLY_ON = "exactly_on" | |
function getPointRelationToLine(point, pair) { | |
const [p1, p2] = pair | |
// if the pair have the same x-values, then they either lie on a | |
// vertical line or are identical | |
if (p2[0] - p1[0] === 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deepSort(x, fn) { | |
fn = fn || ((a, b) => (a < b ? -1 : 1)) | |
if (typeof x === "object") { | |
if (x === null) return x | |
if (x instanceof Array) { | |
return x.map(v => deepSort(v, fn)).sort(fn) | |
} | |