Skip to content

Instantly share code, notes, and snippets.

@hmachii
hmachii / remove_comment.py
Last active August 27, 2025 23:37
コメント除去スクリプト
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
# https://stackoverflow.com/questions/241327/remove-c-and-c-comments-using-python
def comment_remover(text):
def replacer(match):
s = match.group(0)
// calltree.cpp
// g++ -o calltree calltree.cpp tinyxml2.cpp
#include "tinyxml2.h"
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <filesystem>
@hmachii
hmachii / clean.bat
Created August 22, 2025 15:35
Visual Studioの不要ファイル削除
@echo off
rem ============================
rem Visual Studio クリーンアップ
rem ============================
echo -----------------------------
echo Visual Studio 不要ファイル削除
echo -----------------------------
rem ----- ディレクトリ削除 -----
@hmachii
hmachii / vimgrep.vimrc
Created July 11, 2025 10:27
カーソル位置の単語でVimgrep。カーソルは元の位置にとどまる。
function! VimgrepCurrentWordNoJump()
let word = expand('<cword>')
let current_file = expand('%:p')
let current_line = line('.')
let current_winnr = winnr()
" QuickFixウィンドウが開いているかチェック
let qf_open = 0
for winnr in range(1, winnr('$'))
if getwinvar(winnr, '&filetype') == 'qf'
@hmachii
hmachii / gcc.vimrc
Last active July 11, 2025 10:28
編集中のファイルをgccでコンパイル
" gccコマンドを実行する関数
function! RunCmpl()
" 現在のファイル名を取得
let current_file = expand('%:t')
" 現在のファイルのディレクトリを取得
let current_dir = expand('%:p:h')
" 現在のファイルのフルパスを取得
let current_fullpath = expand('%:p')
@hmachii
hmachii / .vimrc
Created April 19, 2025 05:55
vimrc
" termguicolorsが有効かどうか vim --version | grep termguicolors
" 事前にvim plugをインストール https://github.com/junegunn/vim-plug
syntax on " 構文ハイライト有効
set termguicolors " True Color有効
set nocompatible " Vimの挙動にする
set nu " 行番号を表示
set tabstop=4 " タブ幅
set shiftwidth=4 " シフト幅
@hmachii
hmachii / beep.cpp
Last active January 22, 2025 11:21
Windowsでビープ音を鳴らすテスト
#include <windows.h>
#include <iostream>
#include <vector>
#define C4 262
#define D4 294
#define E4 330
#define F4 349
#define G4 392
#define A4 440
@hmachii
hmachii / Main.cpp
Created March 30, 2024 19:38
Siv3DでA*(A star)アルゴリズムの実装
#include <Siv3D.hpp>
// グリッドの設定
const int32 cellSize = 50;
const int32 gridWidth = 40;
const int32 gridHeight = 20;
const int32 initStartPosX = gridWidth / 4;
const int32 initStartPosY = gridHeight / 2;
const int32 initTargetPosX = gridWidth - gridWidth / 4;
const int32 initTargetPosY = gridHeight / 2;
@hmachii
hmachii / MainWindow.xaml
Last active June 7, 2019 17:59
Livetでウィンドウの操作
<Window x:Class="LivetApp3.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:l="http://schemas.livet-mvvm.net/2011/wpf"
xmlns:v="clr-namespace:LivetApp3.Views"
xmlns:vm="clr-namespace:LivetApp3.ViewModels"
Title="MainWindow"
Height="240"
@hmachii
hmachii / Program.cs
Created March 8, 2019 17:16
C#スクリプトからクラス取り出し
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Scripting;
using Microsoft.CodeAnalysis.Scripting;
using System;
using System.IO;
using System.Linq;
using System.Reflection;
namespace ConsoleApp7
{