See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
// qconvert for deno | |
// updated: 2022-10-11, Mindon<mindon@live.com> | |
// e.g. `deno run --allow-read --allow-write --unstable qconvert.ts -i hello.qasm -s qasm -o hello.quil -t quil` | |
// original: https://github.com/quantastica/qconvert-js | |
import { default as QuantumCircuit } from "npm:quantum-circuit"; | |
import { parse } from "https://deno.land/std/flags/mod.ts"; | |
import { exists } from "https://deno.land/std/fs/mod.ts"; | |
import { assert } from "https://deno.land/std/testing/asserts.ts"; |
package main | |
// cadder to start|stop|reload simple caddy servers in current directory, without merge all configs into one | |
// example: /site0/Caddyfile, /site1/caddy.json, `cd /site0/ && cadder start` then `cd /site1/ && cadder start`` | |
// | |
// How to build cadder? | |
// you need download and install golang from <https://go.dev/dl/> then `go build cadder.go` | |
// | |
// author: mindon@live.com | |
// created: 2022-07-14 |
#!/bin/bash | |
# USAGE: curltime DOMAIN_NAME | |
curl -w @- -o /dev/null -s "$@" <<'EOF' | |
time_namelookup: %{time_namelookup}\n | |
time_connect: %{time_connect}\n | |
time_appconnect: %{time_appconnect}\n | |
time_pretransfer: %{time_pretransfer}\n | |
time_redirect: %{time_redirect}\n | |
time_starttransfer: %{time_starttransfer}\n |
/* <div class="dual"><div class="box"><div onclick="this.parentElement.classList.add('flipped')">current</div><div onclick="this.parentElement.classList.remove('flipped')">current</div></div></div> */ | |
.dual { | |
max-width: 100%; | |
position: relative; | |
margin: 2rem 0; | |
perspective: 1280px; | |
} | |
.dual:hover { | |
z-index: 999; |
// A simple helper to test functions not-exported but with _ prefix | |
const privateCases = async function (flpath: string, cases: Function) { | |
const decoder = new TextDecoder("utf-8"); | |
let body = decoder.decode(await Deno.readFile(flpath)); | |
body = body.replace(/\nfunction _/g, "\nexport function _"); | |
const tmppath = flpath.replace(/([^\/]+)$/, "~$1"), | |
encoder = new TextEncoder(); | |
await Deno.writeFile(tmppath, encoder.encode(body)); | |
cases(await import(tmppath)); |
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"net/http" | |
"strings" | |
) |
#!/bin/bash | |
# https://code.luasoftware.com/tutorials/linux/command-line-optimize-image/ | |
find . -type f -iname '*.png' -exec pngquant --skip-if-larger --ext .png --force 256 {} \; | |
find . -type f -iname "*.png" | xargs optipng -o2 -strip all | |
find . -name '*.png' -print0 | xargs -0 -n1 -I{} sh -c 'zopflipng {} output.png; [ -f output.png ] && mv output.png {};' | |
# Using -print0 to deal with spaces | |
find . -print0 -type f -name "*.jpg" -o -name "*.JPG" | xargs -0 jpegoptim |
xhost + ${hostname}
to allow connections to the macOS host *export HOSTNAME=`hostname`
* environment: