Skip to content

Instantly share code, notes, and snippets.

View Hayao0819's full-sized avatar

Yamada Hayao Hayao0819

View GitHub Profile
@Hayao0819
Hayao0819 / show-duplicated.py
Last active January 31, 2024 14:06
同じフォルダの重複ファイルを表示する
# CC0
# https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt
import os
import hashlib
hashlist = []
for file in sorted(os.listdir("."), reverse=True):
if os.path.isfile(file):
@Hayao0819
Hayao0819 / format-kumagaya.sh
Last active February 9, 2024 15:25
熊谷市の8月の最高気温の変化
#!/usr/bin/env bash
set -eEuo pipefail
file="${1-""}"
[[ -n "$file" ]] || {
echo "Usage: $0 <file>" >&2
exit 1
}
linecount=0
while read -r txtline; do
@Hayao0819
Hayao0819 / jirou.ts
Created December 20, 2023 08:06
ラーメン二郎の型定義
export type MenuAmount = "マシ" | "多め" | "マシマシ" | "かなり多め" | "普通" | "少なめ" | "無し";
export type IsGarlicAdded =
| "全てマシ"
| "全て普通"
| "全て少なめ"
| {
ニンニク?: MenuAmount;
ヤサイ?: MenuAmount;
アブラ?: MenuAmount;
#EXTM3U
#EXTVLCOPT:network-caching=1000
#EXTINF:-1,地上波 - NHK総合1・東京
http://192.168.0.10:40772/api/channels/GR/27/services/1024/stream/
#EXTINF:-1,地上波 - NHK総合2・東京
http://192.168.0.10:40772/api/channels/GR/27/services/1025/stream/
#EXTINF:-1,地上波 - NHK携帯G・東京
http://192.168.0.10:40772/api/channels/GR/27/services/1408/stream/
#EXTINF:-1,地上波 - NHK総合1・前橋
http://192.168.0.10:40772/api/channels/GR/18/services/25600/stream/
@Hayao0819
Hayao0819 / factor.py
Created September 24, 2023 14:14
素因数分解
#!/usr/bin/env python3
import math
import sys
def main() -> int:
if len(sys.argv) != 2:
print("error")
return 1
num:int = int(sys.argv[1])
primes:list[int]=factor(num)
@Hayao0819
Hayao0819 / chrome-extension.md
Last active October 21, 2023 11:58
日本学生ネットワークオペレータ連合 LT下書き

単体で動いて移植可能なCLIツールをさっと書いて効率化

自己紹介

  • 群馬大学情報学部 1年 山田ハヤオ/伊藤 駿
  • Fascode Network所属
  • フロントエンドからマイコンまで幅広く勉強中
  • よく書く言語はGolangとシェルスクリプト
@Hayao0819
Hayao0819 / destroy.sh
Last active June 22, 2023 17:35
シェル芸ロシアンルーレット
#!/bin/sh
# 参考
# https://qiita.com/_-_-_-_-_/items/214d537aae2c1488692c
get_random(){
od -v -An --width=1 -tu1 -N1 < /dev/urandom | \
awk "{ print \$1 % 10 }"
}
@Hayao0819
Hayao0819 / quicksort.go
Last active June 2, 2023 05:45
クイックソートのGolang実装
package main
import (
"fmt"
"math"
"math/rand"
"os"
"strconv"
)
ebuild U ] kde-plasma/kwin-5.26.2.1 [5.26.0]
[ebuild U ] kde-plasma/kscreenlocker-5.26.2 [5.26.0]
[ebuild U ] kde-plasma/libkworkspace-5.26.2 [5.26.0]
[ebuild U ] kde-plasma/kde-cli-tools-5.26.2 [5.26.0]
[ebuild R ] x11-themes/QGnomePlatform-0.9.0 USE="wayland%*"
[blocks B ] >=app-accessibility/at-spi2-core-2.46.0 (">=app-accessibility/at-spi2-core-2.46.0" is soft blocking dev-libs/atk-2.46.0)
!!! Multiple package instances within a single package slot have been pulled
!!! into the dependency graph, resulting in a slot conflict:
@Hayao0819
Hayao0819 / SelectMenu.sh
Created October 19, 2022 06:40
メニューに使えるシェル関数。外部依存はありません。
SelectMenu(){
local CaptureSpecialKeys Choices=("$@") CurrentChoice=0 Key=""
CaptureSpecialKeys(){
local SELECTION rest
IFS= read -r -n1 -s SELECTION
#echo "$SELECTION" | hexdump >&2
if [[ $SELECTION == $'\x1b' ]]; then
read -r -n2 -s rest
SELECTION+="$rest"