Skip to content

Instantly share code, notes, and snippets.

View kdmsnr's full-sized avatar

Masanori Kado kdmsnr

View GitHub Profile
@kdmsnr
kdmsnr / main.ts
Last active May 29, 2024 23:30
obsidianでTODO.mdを左のアイコンから開きたい
import { App, Plugin, Notice } from 'obsidian';
export default class MySidebarPlugin extends Plugin {
async onload() {
this.addRibbonIcon('checkmark', 'Open TODO Page', async () => {
const file = this.app.vault.getAbstractFileByPath('TODO.md');
if (file) {
this.app.workspace.getLeaf().openFile(file);
} else {
new Notice('File not found');
@kdmsnr
kdmsnr / md-wiki-link.el
Last active December 29, 2023 19:09
Markdown で [[WikiLink]] を開きたい
@kdmsnr
kdmsnr / gist:f310df591d6de92b11cf64330af2ab02
Last active January 4, 2024 10:20
東京の美術館の展示会を表示するChromeのブックマーク
data:text/html;utf-8,<!DOCTYPE html><body><script>setTimeout(function(){const now = new Date();const year = now.getFullYear();const month = (now.getMonth() + 1).toString().padStart(2, "0");const date = now.getDate().toString().padStart(2, "0");const url = `https://artscape.jp/exhibition/schedule/exhi_schedule_result.php?pref=東京都&Year=${year}&Month=${month}&Day=${date}&period=1&selorder=1&chk_pic=1&f_submit=on`;window.location.replace(url) }, 1);</script></body>
@kdmsnr
kdmsnr / remove-watched-programs-for-tver.tampermonkey.user.js
Last active January 4, 2024 10:22
Remove watched programs for TVer
// ==UserScript==
// @name Remove watched programs for TVer
// @namespace https://kdmsnr.com
// @version 0.1.2
// @description Remove watched programs from the mypage of TVer
// @author kdmsnr
// @match https://tver.jp/mypage/fav
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant none
// @run-at document-end
from sklearn.cluster import KMeans
from sklearn.preprocessing import OneHotEncoder
import numpy as np
import random
# カテゴリカルな属性の値のリスト
genders = ["Male", "Female"]
blood_types = ["A", "B", "O", "AB"]
# メンバーの生成(50人、ランダムな属性)
from sklearn.cluster import KMeans
from sklearn.preprocessing import MinMaxScaler
import numpy as np
import random
# メンバーの生成(50人、ランダムな属性)
# カテゴリカルな属性の場合は、https://gist.github.com/kdmsnr/ed71e9dbbf228b3a03cca99183484ac2 を参照する
members = [
{"name": f"member{i}", "attributes": [random.randint(1, 10), random.randint(1, 10), random.randint(1, 10)]}
for i in range(50)
@kdmsnr
kdmsnr / latex-imenu.el
Last active November 9, 2022 06:56 — forked from kenoss/my-tex-imenu.el
TeXで階層imenu(適当)
(defun latex-create-imenu-index ()
(let ((index '())
(pattern (rx "\\" (group (or "part" "chapter" "section" "subsection" "paragraph" "subparagraph"))
"{" (group (* (not (any "}")))) "}"))
(pairs '(
(part . 0)
(chapter . 0)
(section . 2)
(subsection . 4)
(paragraph . 6)
@kdmsnr
kdmsnr / product-research-rules-urls.md
Last active May 30, 2024 07:26
『プロダクトリサーチ・ルールズ』参照URL一覧

『プロダクトリサーチ・ルールズ』参照URL一覧

はじめに

Ch1:恐れることなく間違える準備をする

;; * come-fromリンクは自動リンクのための機能に限定したい
;; * wiki記法は単にタイトルにマッチするところにリンクしたい
;; * goto-linkはもっと広い検索にしたい(wiki記法との違いを出したい)
(defun howm-keyword-search-create (title)
(let* ((q (replace-regexp-in-string "<<< " "" title)))
(howm-keyword-search-subr (concat howm-view-title-header " " q) nil nil)))
@kdmsnr
kdmsnr / alfred-workflow-scrapbox.rb
Last active September 3, 2021 05:24
AlfredのワークフローでScrapboxを検索する
# Originally created by Yuta Yamamoto <https://github.com/tuki0918/alfred-scrapbox-listview>
file = "/tmp/#{ENV['projectId']}-scrapbox.json"
if !File.exist?(file) or File.mtime(file) < (Time.now - 3*3600)
`/usr/bin/curl -H "Cookie: connect.sid=#{ENV['token']}" -o #{file} -s "https://scrapbox.io/api/pages/#{ENV['projectId']}?limit=1000&sort=accessed"`
end
q = `echo "{query}" | /usr/local/bin/nkf -w --ic=utf8-mac`
q.strip!