Skip to content

Instantly share code, notes, and snippets.

@trueroad
trueroad / clustering.py
Last active February 10, 2026 08:35
Perform hierarchical/agglomerative clustering.
#!/usr/bin/env python3
"""
Perform hierarchical/agglomerative clustering.
https://gist.github.com/trueroad/c0fd706b5a68bb5d36698bbce72f1bef
Copyright (C) 2026 Masamichi Hosoda.
All rights reserved.
Redistribution and use in source and binary forms, with or without
@trueroad
trueroad / calc_distance_matrix.py
Last active February 4, 2026 10:34
Calc distance matrix from SMFs (Standard MIDI Files).
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Calc distance matrix from SMFs (Standard MIDI Files).
https://gist.github.com/trueroad/96bbe0d936bd68454d10bf20595eb424
Copyright (C) 2026 Masamichi Hosoda.
All rights reserved.
@trueroad
trueroad / smf_distance.py
Last active February 4, 2026 10:06
Calc SMF (Standard MIDI File) Distance.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Calc SMF (Standard MIDI File) Distance.
https://gist.github.com/trueroad/a704a7ab54a851c0ddfbb359b2e7f87a
Copyright (C) 2026 Masamichi Hosoda.
All rights reserved.
@trueroad
trueroad / config_file.py
Last active November 4, 2025 12:25
TOML config file class for python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
TOML config file class for python.
https://gist.github.com/trueroad/b0d051af003c61aafb3eac0c051e5f89
Copyright (C) 2025 Masamichi Hosoda.
All rights reserved.
@trueroad
trueroad / show_smf_abs_tick.py
Last active September 18, 2024 12:58
Show SMF's absolute tick and note event like LilyPond event-listener.ly.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Show SMF's absolute tick and note event like LilyPond event-listener.ly.
https://gist.github.com/trueroad/04aeccd92122c6428a9442dd55dffc61
Copyright (C) 2024 Masamichi Hosoda.
All rights reserved.
@trueroad
trueroad / Makefile
Last active September 18, 2024 10:19
Test cairo overwrite notehead.
#
# LilyPond で生成した楽譜の符頭にバツ印やテキストを上書きしてみるテスト
#
#
# 動作環境
# LilyPond 2.24.3
# Python 3.9
# python-cairo, pypdf
# Poppler
@trueroad
trueroad / show_pdf_link.py
Last active September 18, 2024 10:13
Show PDF link annots.
@trueroad
trueroad / pcsc-test.c
Last active March 22, 2024 12:26
PC/SC test
//
// PC/SC test
// https://gist.github.com/trueroad/ad9c222a667d5091a118196301b938a0
//
// Copyright (C) 2024 Masamichi Hosoda.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
@trueroad
trueroad / show_smf_parameters.py
Last active January 25, 2024 11:01
Show SMF (Standard MIDI File) parameters.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Show SMF (Standard MIDI File) parameters.
https://gist.github.com/trueroad/aca02ee6b36f8aee0ac7bebbdde912fc
Copyright (C) 2024 Masamichi Hosoda.
All rights reserved.
@trueroad
trueroad / show_zipped_sound_file_parameters.py
Last active January 21, 2024 02:32
Show zipped sound_file_parameters.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Show zipped sound_file_parameters.
https://gist.github.com/trueroad/
Copyright (C) 2024 Masamichi Hosoda.
All rights reserved.