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 { | |
| serve, | |
| type ConnInfo, | |
| type Handler, | |
| type ServeInit, | |
| } from 'https://deno.land/std@0.144.0/http/server.ts'; | |
| function assertIsNetAddr(addr: Deno.Addr): asserts addr is Deno.NetAddr { | |
| if (!['tcp', 'udp'].includes(addr.transport)) { | |
| throw new Error('Not a valid network address'); |
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(svgdoc, scale) { | |
| // optimize large embed images in a svg | |
| // usage: <html><body><svg>your own real svg with too large embeded images...</svg><script src="optimize-embed-images-size-in-svg.js">< /script></body></html> | |
| // author: mindon@live.com | |
| function optimize(img, cb) { | |
| const src = img ? img.getAttribute("xlink:href") : undefined; | |
| let c = document.createElement("canvas"); | |
| const done = () => { | |
| cb && cb(); |
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
| package main | |
| import ( | |
| "context" | |
| "log" | |
| "net/http" | |
| "net/url" | |
| "os" | |
| "path" | |
| "path/filepath" |
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
| # $autorun-early | |
| require 'open3' | |
| # mindon@live.com 2022-04-02 | |
| module DRC | |
| module Hook | |
| def self.on(drc, macro) | |
| name = 'KLAYOUT_HOOK_DRC' | |
| body = macro.text |
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
| package main | |
| import ( | |
| "crypto" | |
| "crypto/rand" | |
| "crypto/rsa" | |
| "crypto/sha256" | |
| "crypto/x509" | |
| "encoding/hex" | |
| "encoding/pem" |
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
| .clock { | |
| display: inline-block; | |
| --size: 360px; | |
| width: var(--size); | |
| height: var(--size); | |
| position: relative; | |
| overflow: hidden; | |
| } | |
| .clock > .hour { | |
| --pointer-size: 12px; |
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 guides(hashes, shared) { | |
| let g = undefined, | |
| gs = {}, | |
| list = [], | |
| step = 0, | |
| astyle, | |
| padding, | |
| m, | |
| width = 0, | |
| height = 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
| .yinyang { | |
| --size: 360px; | |
| --dot: 60px; | |
| --yin: #222; | |
| --yang: #c30; | |
| --duration: 8s; | |
| width:var(--size); | |
| height:var(--size); | |
| position: relative; | |
| overflow: hidden; |
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 { Response } from "https://deno.land/std@0.103.0/http/server.ts"; | |
| export async function wasmAt(src: string): Promise<any> { | |
| if(/^http[s]?:\/\//i.test(src)) { | |
| return fetch(src); | |
| } | |
| return new Response(await Deno.readAll(await Deno.open(src)), {status: 200, headers:{ | |
| 'content-type': 'application/wasm' | |
| }}); | |
| } |
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
| let cifblocknr = 1; | |
| const findsymtolerance = 0; | |
| // convert VASP POSCAR to cif format | |
| function vasp2cif(poscar: string): string { | |
| const lines = poscar.split('\n'); | |
| const cell = new Cell(); | |
| cell.HMSymbol = "'P 1'"; | |
| cell.label = cifblocknr.toString(); |