Skip to content

Instantly share code, notes, and snippets.

View tadd's full-sized avatar

Tadashi Saito tadd

View GitHub Profile
@tadd
tadd / Makefile
Last active November 24, 2025 15:55 — forked from trueroad/Makefile
ipsj.cls を upLaTeX 用にしてみる(源ノ明朝・源ノ角ゴシックを使う)
# Modified by Tadashi Saito (@tadd), 2022
# https://gist.github.com/tadd/72fd6cd1efa41ea5b4e38a1cce9c7ad5
#
# ipsj.cls を upLaTeX 用にしてみる(源ノ明朝・源ノ角ゴシックを使う)
# https://gist.github.com/trueroad/c44312923bf02226c2274388941d0453
#
# ipsj.cls は pLaTeX 専用のようなのですが、
# 試しに upLaTeX で使えるようにした up-ipsj.cls を作ってみました。
# upLaTeX なので pLaTeX では難しかった源ノ明朝・源ノ角ゴシックの利用が
# できるようになります。
@tadd
tadd / dot.lesskey
Last active July 12, 2023 10:28
readline-like `.lesskey` (Why not in /etc/skel?)
#line-edit
^A home
^E end
^P up
^N down # Overriding!
^F right
^B left
^K kill-line
^D delete
@tadd
tadd / irb-banner.rb
Last active June 2, 2023 15:53
Customization of IRB Inspection
class Array; def inspect = IO.popen(['banner', to_s], &:read).chomp; end
conf.echo_on_assignment = true # never truncate # IRB.conf[:ECHO_ON_ASSIGNMENT] = true
conf.inspect_mode = :inspect # IRB.conf[:INSPECT_MODE] = :inspect
@tadd
tadd / gen-git-push-instead-of.sh
Last active January 31, 2023 16:39
Generate shortcut urls for .gitconfig
# Usage: sh gen-git-pushj-instead-of.sh github.com-name [gitlab.com-name] >>~/.gitconfig
# Then:
# git clone gist:711a1f04cd89e488fb08ef562e045f43 # or
# git clone gh:ruby/ruby
_url()
{
printf "[url \"git@$2:${3:+$3/}\"]\n\tinsteadOf = $1:\n"
}
@tadd
tadd / git-push
Last active November 11, 2023 05:16
Force not to use `git push -f` but `--force-with-lease`
#!/bin/bash -eu
argv="$(sed -E 's/(^| )-f\b/\1--force-with-lease/g' <<<$@)"
exec git push ${argv}
type -t git-$1 >/dev/null && exec git-$1 "${@:2}" || git "$@"
@tadd
tadd / update-all-pkgs
Last active July 22, 2023 09:52
I can (not) update everything of my Debian system at once.
#!/bin/sh
# First of all, there is one bad news: you cannot update everything in this script.
# Below is my current status and methods.
#
# * System pacakges: apt update && apt upgrade
# * Firmware: fwupdgmr refresh && fwupdgmr update
# * Chrome, Firefox, and Thunderbird: they won't be updated unless booted (maybe?)
# if you installed binary from upstreams
# * Emacs itself: using distro's package
@tadd
tadd / taika.js
Last active November 9, 2025 08:08
大化の改新が二回起こる件について(蘇我入鹿は二度死ぬ)
const [localeYear, localeLongDate] = [{year: 'numeric'}, {dateStyle: 'long'}].map(o =>
d => d?.toLocaleString("ja-JP-u-ca-japanese", o));
const isoDate = d => d?.toISOString().slice(0, "yyyy-mm-dd".length);
const d = new Date(643, 0, 1); // 643-01-01
const n = 365 * 4; // ~ 4 years
let yPrev, dPrev;
for (let i = 0; i < n; i++) {
const y = localeYear(d);
if (y !== yPrev) {
@tadd
tadd / chaining.rb
Last active August 16, 2022 09:54
Easier method chaining for Ruby
# Only for those who are too lazy to write `self` at the end of their methods
def tapper(m)
Module.new do
define_method(m) do |*a, **k, &b|
tap { super(*a,**k, &b) }
end
end
end
@tadd
tadd / LICENSE
Last active December 17, 2022 10:36
Moved: https://github.com/tadd/academize.el (格調高いアカデミックな文章を自動的に生成してくれる便利なスクリプト)
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for