Skip to content

Instantly share code, notes, and snippets.

Avatar

K.Nakagawa earlgreyxxx

View GitHub Profile
View renew-sslcert.cmd
@ECHO off
REM certbot wrapper
REM renew-sslcert [test]
REM testを指定すると、--dry-run (シミュレーション)を付けて実行します。
SETLOCAL
if "%~1"=="test" (
SET DRYRUN=--dry-run
) else (
SET DRYRUN=
)
View certbot-postauth.cmd
@ECHO off
REM CERTBOT MANUAL CLEANUP AUTH HOOK
REM CERTBOTから下記環境変数がセットされてこのファイルが実行されますので、この情報を使ってFTPなどで認証ファイル削除します。
REM CERTBOT_DOMAIN : The domain being authenticated
REM CERTBOT_VALIDATION : The validation string
REM CERTBOT_TOKEN : Resource name part of the HTTP-01 challenge (HTTP-01 only)
REM CERTBOT_REMAINING_CHALLENGES : Number of challenges remaining after the current challenge
REM CERTBOT_ALL_DOMAINS : A comma-separated list of all domains challenged for the current certificate
View sslcert.cmd
@ECHO off
REM certbot wrapper
REM sslcert <ドメイン名> [test]
REM testを指定すると、--dry-run (シミュレーション)を付けて実行します。
SETLOCAL
if "%~1"=="" (
ECHO SSL証明書を取得するドメイン名を入力してください。
GOTO END
)
View index.js
// ロード
import pdf2img from './pdf2img.js';
(($) => {
// PDFファイル選択
// --------------------------------------------------------------------------
async function onChangeFile(ev)
{
if(this.files.length <= 0)
return;
@earlgreyxxx
earlgreyxxx / pdf2img.js
Last active December 24, 2022 12:17
convert pdf to image
View pdf2img.js
/****************************************************************************
* convert pdf to jpeg
*
* file: File instance (File object),
* type: output image format name (String: 'image/jpeg' or 'image/png' only)
* resolution: output resolution (INTEGER)
****************************************************************************/
import './pdfjs/build/pdf.min.js';
// おまじない。よくわからんけど、付けないとなんかエラー?がでるみたい。
View MarcDataParser.js
/******************************************************************************
Japan Marc Dat file
******************************************************************************/
const MATERIALS = new Map([
['a','図書'],
['c','楽譜'],
['e','地図資料'],
['g','映像資料'],
View table2json.js
/*****************************************************************************
*
* table to json
*
*****************************************************************************/
(function() {
HTMLTableElement.prototype.toJSON = toJSON;
HTMLTableElement.prototype.toArray = toArray;
function toJSON(indent,fn,headers)
View append-excel-es6.js
/*******************************************************************************
description:
ローカルのエクセルファイルを選択すると(<input type="file" id="select-file">、
選択したエクセルファイルへシートを追加し、テーブル要素(<table id="table-0">)を書込み、
そのエクセルシートをダウンロードするためのリンクをdocument.body に追加します。
※このままのコードだと、セルの書式属性は全部消えます。
*******************************************************************************/
(function($) {
View worker.js
importScripts('./node_modules/comlink/dist/umd/comlink.min.js');
async function resizer(file,offscreencanvas,max)
{
let width = max,height = max;
let img = await createImageBitmap(file);
let ratio = img.width / img.height;
if(ratio < 1 && img.width <= max)
return file;
View resize.image.js
/**************************************************************************
* resize image in file
**************************************************************************/
import * as Comlink from "./node_modules/comlink/dist/esm/comlink.min.mjs"
export default async function(file,max)
{
let canvas = document.createElement('canvas');
let offscreencanvas = canvas.transferControlToOffscreen();