Skip to content

Instantly share code, notes, and snippets.

@naosim
naosim / screenshot-on-chome.js
Created July 23, 2024 20:33
起動中のchromeでカレンダーを表示してスクショする
// chromeを起動する
// "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir=remote-profile
import puppeteer from 'puppeteer';
// Or import puppeteer from 'puppeteer-core';
// Launch the browser and open a new blank page
// const browser = await puppeteer.launch();
const browser = await puppeteer.connect({
browserURL: 'http://127.0.0.1:9222',
@naosim
naosim / post-slack-with-image.js
Created July 23, 2024 20:26
slackに画像を送る
import { IncomingWebhookClient } from 'https://unpkg.com/@slack/webhook@latest/dist/cjs/index.js';
import fs from 'fs';
const url = 'YOUR_SLACK_WEBHOOK_URL'; // Incoming Webhook URL
const channel = '#general'; // 送信先チャンネル
const message = '画像を送信します'; // メッセージ
const filePath = 'image.jpg'; // 送信する画像ファイルのパス
(async () => {
@naosim
naosim / メモ.txt
Created June 24, 2024 23:00
メモ
自身の技術専門職について発表する際に、聞き手が知りたがるであろう疑問や問いを以下のように箇条書きで示します:
技術専門職としての役割や責任は何ですか?
最近取り組んでいるプロジェクトや課題は何ですか?
業務上の課題や障害にどのように対処していますか?
最新の技術トレンドや業界の動向をどのように把握していますか?
チームとのコラボレーションやコミュニケーションはどのように行っていますか?
今後の展望やキャリアパスについてどのような考えがありますか?
技術やスキルの向上のために何をしていますか?
他の部署や職種との連携や協力体制はどのように構築していますか?
@naosim
naosim / gridjs_sample.html
Created May 1, 2024 03:08
gridjsサンプル
<!DOCTYPE html>
<html lang="en">
<head>
<link
href="https://unpkg.com/gridjs/dist/theme/mermaid.min.css"
rel="stylesheet"
/>
</head>
<body>
<div id="wrapper"></div>
@naosim
naosim / note.txt
Created March 22, 2024 13:32
てすと
テストだよ
@naosim
naosim / tableSchema.json
Created February 11, 2024 11:38
テーブル定義のためのJSON Schema
{
"type": "array",
"items": {
"$ref": "#/$defs/table"
},
"$defs": {
"table": {
"name": "table",
"type": "object",
"properties": {
@naosim
naosim / pocco.mjs
Last active December 22, 2023 20:29
pocco
import http from "http";
import fs from "fs";
import path from "path";
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const server = http.createServer((req, res) => {
const reqPath = req.url;
const sanitizedPath = path.normalize(reqPath).replace(/^(\.\.[\/\\])+/, '');
@naosim
naosim / ipv6.js
Last active November 28, 2023 13:37
ipv6
function getBitsAfter33(ipv6) {
function hexTo2Bits(v, bitLength = 4) {
if(v >= 10) {
v = "ABCDEF"[v - 10]
}
return (new Array(bitLength).fill("0").join("") + parseInt(v, 16).toString(2)).slice(-bitLength);
}
function bit2toHex(num) {
var p = num.split("").reverse().map((v, i) => Math.pow(2, i) * parseInt(v)).reduce((memo, v) => memo + v, 0);
if(p < 10) {
@naosim
naosim / todo.js
Last active July 31, 2023 14:11
spreadsheetでtaskAPIを使ってタスクを管理する
// いい感じに同期します
// 新規タスクの追加
// 変更点の更新
// GoogleTasksの読み込み
function update() {
new MainService().update();
}
function onOpen() {
const customMenu = SpreadsheetApp.getUi()
@naosim
naosim / todaysSchedule.js
Created April 17, 2023 11:26
Googleカレンダーの予定取得
function exportCalendarEvents() {
// カレンダーIDを入力してください
var calendarId = "primary";
// フォーマット
var format = "yyyy/MM/dd HH:mm:ss";
// 今日の日付を取得
var today = new Date();
// 今日の0時0分0秒を計算
var startOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate());