Skip to content

Instantly share code, notes, and snippets.

View phanect's full-sized avatar

Jumpei Ogawa phanect

View GitHub Profile
@phanect
phanect / async-err-main.cjs
Last active May 12, 2024 03:15
Experiment if error stops the Node.js process as a failure. (Tested on Node.js v22.1.0)
const { fn } = require("./async-err-lib.cjs");
(async () => {
await fn();
})();

Check Sha256Sum on Windows 11 PowerShell

certutil -hashfile "C:\Users\phane\OneDrive\Desktop\neon-user-20240412-1535.iso" SHA256
@phanect
phanect / README.git.md
Last active May 12, 2024 23:17
Collection of Git command snippets

Collection of Git command snippets

{
// ...
"exports": {
".": {
"import": "./dist/main.mjs",
"require": "./dist/main.cjs"
},
"./style.css": {
"import": "./dist/style.css",
"require": "./dist/style.css"
#!/usr/bin/env bash
set -eu
DIRNAME="$(realpath "$(dirname -- "${BASH_SOURCE[0]}")")"
PROJECT_ROOT="$(realpath "${DIRNAME}/..")"
@phanect
phanect / template-script.mjs
Last active May 12, 2024 23:12
JSM (JavaScript modules, aka. ESM) Template for task scripts
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = fileURLToPath(new URL(".", import.meta.url));
@phanect
phanect / neon-setup.md
Last active May 15, 2024 20:34
Personal setup instruction for my KDE neon box

1. Update and install software

sudo pkcon refresh
sudo pkcon update

sudo apt install --ignore-missing \
  curl \
  git \
 git-filter-repo \
@phanect
phanect / local-php-server.sh
Last active December 13, 2023 21:23
local-php-server.sh
docker run --rm -it -p 4000:80 -v /path/to/siteroot:/var/www/html php:apache-buster
@phanect
phanect / createdb.md
Last active March 7, 2021 07:16
Create database
/**
* Assert if objects are equal. This function also considers `not`
* @return true if obj1 and obj2 are equal, otherwise false
*/
function _objEquals(obj1, obj2) {
const keys1 = obj1.getOwnPropertyNames().sort(sortByCharCode),
keys2 = obj2.getOwnPropertyNames().sort(sortByCharCode),
sortByCharCode = function(key1, key2) {
if (key1 < key2) {
return -1;