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
#!/bin/sh | |
# gtags の実行はこう | |
# (cd /usr/include ; for path in "${HOME}/.gtags.d/usr/include" ; do if [ ! -d "$path" ]; then mkdir -p "$path"; fi ; gtags "$path" ; done ;) | |
prepare_docker_image (){ | |
docker build --network=host -t $(id -u -n)/global - <<EOF | |
FROM $(lsb_release --id --short | tr [:upper:] [:lower:]):$(lsb_release --codename --short)-slim | |
RUN apt update \ |
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
;; init.el に書き込むよう | |
(require 'man) | |
;; マニュアルエントリーポイント | |
(defun my-altman (manual-entry) | |
"alternative man | |
(my-altman MAN-ARGS) | |
" | |
(interactive "sManual Entry: ") |
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
(defun null-device-aware-tramp () | |
"get null device name for use with TRAMP on remote systems | |
(null-device) | |
Example: | |
(dolist (buffer-name (list \"*scratch*\" \"mit\")) | |
(with-current-buffer (get-buffer buffer-name) | |
(message \"%s > %s\" buffer-name (null-device-aware-tramp)))) | |
" | |
(if (not (file-remote-p default-directory)) |
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
#define _GNU_SOURCE | |
/** | |
https://openradar.appspot.com/37537852 | |
*/ | |
#include <stdlib.h> | |
#include <stdio.h> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"/> | |
<meta name="viewport" content="width=device-width,initial-scale=1" /> | |
<meta name="format-detection" content="telephone=no" /> | |
<title>_</title> | |
<link rel="icon" href="data:;base64,iVBORw0KGgo="> | |
<script type="text/javascript"> |
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
audioTail = Promise.resolve(); // 初期値は、 resolved | |
private addQueue( audioData : ArrayBufer , volume : Number ) | |
{ | |
// promise.promise は、 audioDataが再生されたら履行される promise である。 | |
const promise = (function(){ // Promise.withResolvers() の implementation | |
const promise = {}; | |
promise.promise = new Promise( (resolve, reject)=>{ | |
promise.resovle = resovle; |
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
/** | |
ハンドル済みの、rejectされるPromise を返す。 | |
Promise.reject() とほぼ 等価であると考える。 | |
Promise.reject() を使いたいが、 Promise.reject() をそのまま使おうとすると | |
UnhandledRejection エラーが発生して、これは node.js を終了させてしまう。 | |
本来、Reject済みの Promise は、Reject済みの Promise としてそのまま使えれば良いのだが、 | |
async function を await する時の例外を受け持つという役割があり、例外の無視はもっと良くないとの事だろうけど | |
ここは reject() を遅延させる手法をとる。 |
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
if( true ){ // スタックトレースを取得するための方法 | |
// ファイル名及び 行番号付きの log を提供する。 | |
const logger = new Proxy( console , { | |
get: function( target, prop ,receiver ){ // これの呼び出しが [2] | |
switch( prop ){ | |
case 'log': | |
case 'warn': | |
case 'debug': | |
case 'error': | |
{ |
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 obj = {"name": undefined}; | |
for (const prop of (function*(){ for (const p in obj ){ if( obj.hasOwnProperty( p ) ){ yield p; } }})() ){ | |
console.log( prop ); | |
} |
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
/** | |
DOM EventTarget は、 node.js でも実装されている。 | |
ウェブブラウザーでは、 CustomEvent が使えるが、 Node.js でこれが実装されたのは v19 からなので | |
Event で代用する。 | |
イベント: | |
wakeup-queue-wait: queu に何か追加されたり、shutdown されたりするのを待機するためのイベント |
NewerOlder