Skip to content

Instantly share code, notes, and snippets.

View mh61503891's full-sized avatar
🍣

Masayuki Higashino mh61503891

🍣
View GitHub Profile
#! /usr/bin/env python3
# Usage:
# $ python3 this.py > output.csv
# $ nkf --overwrite --oc=UTF-8-BOM output.csv
import glob
import hashlib
import os
import sys
@mh61503891
mh61503891 / sshd_config
Created July 16, 2023 12:10
Default config of sshd on Debian GNU/Linux 12.0
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/bin:/usr/games
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
@mh61503891
mh61503891 / bib.gs
Last active May 24, 2023 10:43
bib.gs
// Googleシートからは `=TOROW(BIB(A1))` のように使う。
function BIB(isbn) {
return _getBibEntriesAsListByIsbn(isbn);
}
function _getBibEntriesAsListByIsbn(isbn) {
const entries = _getBibEntriesAsMapByIsbn(isbn);
return [
entries.isbn,
@mh61503891
mh61503891 / toggle-JIMPrefPunctuationType.sh
Created February 11, 2023 08:14
Toggle JIMPrefPunctuationType
JIMPrefPunctuationTypeKey=$(defaults read com.apple.inputmethod.Kotoeri JIMPrefPunctuationTypeKey)
if [ $JIMPrefPunctuationTypeKey -eq 0 ]; then
defaults write com.apple.inputmethod.Kotoeri JIMPrefPunctuationTypeKey 3
elif [ $JIMPrefPunctuationTypeKey -eq 3 ]; then
defaults write com.apple.inputmethod.Kotoeri JIMPrefPunctuationTypeKey 0
fi
killall -HUP "JapaneseIM-RomajiTyping"
@mh61503891
mh61503891 / main.dart
Last active December 30, 2022 17:53
SnackBar with Riverpod
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
// ...
ref.listen(
snackBarProvider,
(previous, next) {
if (mounted && next != null) {
ScaffoldMessenger.of(context).showSnackBar(next);
}
},
@mh61503891
mh61503891 / bookmarklet-highlight-updated-reports-in-manaba.js
Last active August 22, 2022 12:52
Bookmarklet: Highlight Updated Reports in Manaba
const table = document.getElementsByTagName("table")[2];
for (const row of table.rows) {
try {
const last_submitted_at = new Date(row.cells[3].innerText.split("\n")[0]);
const last_scored_at = new Date(row.cells[6].innerText.split("\n")[0]);
if(last_submitted_at > last_scored_at) {
row.style.backgroundColor = "red";
} else {
/* do nothing */
}
@mh61503891
mh61503891 / export-urls-from-safari-reading-list.rb
Last active August 16, 2022 07:06
Exporting URLs from Safari's Reading List via Ruby
# Copy ~/Library/Safari/Bookmarks.plist to ./Bookmarks.plist via Finder
# plutil -convert xml1 -o ./Bookmarks.xml ./Bookmarks.plist
# export-urls-from-safari-reading-list.rb > safari-reading-list.csv
require "bundler/inline"
gemfile do
source "https://rubygems.org"
# https://github.com/patsplat/plist
gem "plist"
end
@mh61503891
mh61503891 / example1.rb
Last active August 11, 2022 12:21
Using SSL_OP_LEGACY_SERVER_CONNECT in Ruby's net/http
# https://stackoverflow.com/a/24237525
require "net/http"
(Net::HTTP::SSL_IVNAMES << :@ssl_options).uniq!
(Net::HTTP::SSL_ATTRIBUTES << :options).uniq!
Net::HTTP.class_eval do
attr_accessor :ssl_options
end
@mh61503891
mh61503891 / gist:a1cb95123ea7774977c4ab30932fcd1d
Last active June 9, 2022 03:15
研究ノート用システムの検討(コメント募集中です。)
## 必要な機能の検討
- 学部生でも簡単に使える。
- 研究ノートを日報形式で作成できる。
- 研究ノートにコメントを書ける。
- 研究ノートを検索できる。
- 研究ノートの変更履歴を記録できる。
- 研究ノートの変更履歴を表示する際は差分やタイムスタンプを確認できる。
- 研究ノートをエクスポートしてアーカイブできる。
- エクスポートした研究ノートにはタイムスタンプ、著者、本文、コメントが含まれる。
@mh61503891
mh61503891 / remove_lgtms_on_qiita.user.js
Last active May 25, 2022 06:57
Remove LGTMs on Qiita
// ==UserScript==
// @name Remove LGTMs on Qiita
// @namespace Violentmonkey Scripts
// @match https://qiita.com/*
// @grant GM_getValue
// @grant GM_setValue
// @run-at document-idle
// @version 2.0
// @description NOTE: This script only works on the page displayed circle-button of LGTM. Please open the entry page on a full-width size display.
// ==/UserScript==