Skip to content

Instantly share code, notes, and snippets.

View kwappa's full-sized avatar

Hiromu Shioya kwappa

View GitHub Profile
data = [
# [ id, input, expected ],
[ 0, "4*5+6&7|8", "44" ],
[ 1, "15*5", "75" ],
[ 2, "15+5", "20" ],
[ 3, "15&5", "5" ],
[ 4, "15|5", "15" ],
[ 5, "30*15*5", "2250" ],
[ 6, "30*15+5", "600" ],
[ 7, "30*15&5", "150" ],
create table sales (
sold_at datetime,
product_name text,
product_color text,
customer_gender text,
customer_age integer,
customer_prefecture integer
);
insert into sales values ('2017-02-17 11:20:30', 'Cupcake', 'green', 'male', 35, 28);

これはドワンゴ Advent Calendar 2018 12/24の記事です。

プログラミング研修教材

ドワンゴを含むカドカワグループでは、エンジニア職以外の社員に簡単なプログラミングを学ぶ機会を提供しています。その教材やカリキュラムの作成と講義をわれわれ技術コミュニケーション室で担当しています。

プログラミング未経験のみなさんにコードを書いて問題を解決する、ということを教えるのはとても有意義だが難しい仕事でした。ソフトウェアエンジニアという仕事を長く続けていると、プログラミングに関する多くのことを自明として片付けてしまい、初学者にわかりやすくかつウソのない説明をするのはなかなか困難です。先日ご恵贈いただいた「かんたんRuby」という本の書評でもその難しさについて触れました。

このようなミッションに取り組む方がいたら、少しでも参考になればと思い公開します。

@kwappa
kwappa / techbookfest-monthly-sales.js
Created June 2, 2024 01:55
技術書典の月別販売状況ページからスプレッドシートにコピペできるTSVを得る
// https://techbookfest.org/organization/********/sales
// 技術書典の月別販売状況ページからスプレッドシートにコピペできるTSVを得る
const rows = document.getElementsByClassName("MuiTableBody-root")[0].rows
const ary = Array.from(rows)
const r = ary.map(getRowValue)
console.log(r.join("\n"))
function getRowValue(row) {
const name = row.firstChild.firstChild.children[1].firstChild.firstChild.firstChild.textContent.trim()
@kwappa
kwappa / ts2mp4.sh
Last active August 16, 2025 01:08
よく使うメディア変換コマンドメモ
# 複数の動画ファイル(*.ts)を結合してMP4に再エンコードする
# *.tsを列挙してffmpeg用インプットファイルを作る
for f in *.ts; do echo "file '$f'" >> list.txt; done
# list.txtをインプットとしてMP4にエンコードする
# crf : Constant Rate Factor 0〜51 低いほど高品質 デフォルト 23
# 90分の動画を -crf 23 でエンコードすると200MBを超えることがあるので 25 を指定している
ffmpeg -f concat -i list.txt -c:v libx265 -crf 25 -preset medium -tag:v hvc1 -c:a aac -b:a 128k output.mp4
@kwappa
kwappa / whisper-transribe.sh
Created March 19, 2026 05:03
whisper-cppによる文字起こしスクリプト
#!/bin/bash
set -euo pipefail
WHISPER_MODELS="${WHISPER_MODELS:-/Volumes/YourDrive/whisper-models}"
usage() {
cat <<EOF
Usage: $(basename "$0") [-l lang] [-m model] <input_file>
Options: