Skip to content

Instantly share code, notes, and snippets.

@smeghead
smeghead / lubuntu-setup.md
Last active January 4, 2025 12:36
Lubuntu の初期設定

Lubuntuのセットアップ

2024-11-09 Lubuntuのセットアップをするので、作業内容を記録します。

CapsLock

XKBOPTIONS="ctrl:nocaps" の行を追加する。

$ cat /etc/default/keyboard 
@smeghead
smeghead / phel-tdd.md
Last active September 12, 2024 11:02
phel-lang で小さいプログラムを作る方法 (TDD)

phel-lang で小さいプログラムを作る方法 (TDD)

phel-lang を使って小さいプログラムを作るのをTDD(テスト駆動開発)で進める場合に、どのように作成しているかを順番に書いてみます。

作るものを決める

一次元セル・オートマトンでフラクタル図形を描画することができるというのがおもしろいと思い、phel-langで実装してみることにしました。

1次元セル・オートマトン | Wikipedia

@smeghead
smeghead / ShowTest.php
Last active September 1, 2024 16:02
ShowTest DataFactory
<?php
namespace Tests\Feature\View\Function;
use App\Models\PhelFunction;
use App\Models\PhelNamespace;
use App\Models\UsageExample;
use App\Models\User;
use Tests\TestCase;
<?php
declare(strict_types=1);
namespace Nagoya;
interface Expression {
public function toString(): string;
}
class Number implements Expression {
@smeghead
smeghead / HyperLinkText.php
Created August 22, 2023 04:55
テキスト内のURLをタグ化しながら、全体をエスケープするクラス
<?php declare(strict_types=1);
namespace Domain;
/**
* URLを含むテキストをエスケープする。
* URLはリンクとして出力します。
* 改行は<br>を出力します。
*/
final class HyperLinkText {
private string $text;
@smeghead
smeghead / PERSONAL.XLSB
Last active December 6, 2022 02:42
行の高さを設定するマクロ
Sub 高さ()
'
' 高さ Macro
' 行の高さを、カレントセルの高さに設定する。
'
' Keyboard Shortcut: Ctrl+Shift+H
'
Dim rowNo
rowNo = ActiveCell.Row
Dim height
@smeghead
smeghead / custom.css
Created November 22, 2022 02:48
Github Shortcode プラグインのレイアウト崩れを調整する WordPress Customizing Additional CSS
article.post_body .github-box .github-box-download,
article.post_body .github-box .github-box-title .github-stats,
article.post_body .github-box .github-box-title .forks
{
height: auto;
}
@smeghead
smeghead / grep.vim
Created April 19, 2021 07:09
Vim で ripgrep を使って非同期grep
command! -nargs=* Grep call Grep(<f-args>)
function! Grep(...)
let command = ["AsyncRun!", "rg", "--vimgrep", "--no-heading"]
call extend(command, a:000)
execute join(command)
endfunction
@smeghead
smeghead / hot.rs
Last active January 29, 2021 02:11
毎日コーディング勉強会コミュニティ
use std::cmp;
//以下の配列は2019/7/1〜9/30までの最高気温の配列です。最も長い、30度を越えた連続日数を求めるプログラムを作成せよ
fn main() {
let temperatures = [25.7, 27.2, 26.3, 28.8, 30.5, 27.9, 29.5, 28.6, 28.5, 31.0, 24.8, 29.8, 26.3, 25.5, 29.2, 30.4, 30.3, 29.3, 26.3, 29.9, 30.3, 28.1, 32.0, 31.8, 32.1, 34.1, 29.1, 31.7, 32.9, 33.1, 34.8, 35.2, 36.5, 34.1, 33.0, 36.2, 34.9, 34.0, 32.3, 33.3, 34.5, 34.4, 36.7, 36.6, 35.6, 32.2, 31.2, 33.2, 33.7, 31.1, 30.6, 31.7, 31.9, 29.3, 28.9, 30.5, 29.6, 26.9, 27.5, 29.8, 28.2, 28.4, 29.0, 31.8, 31.2, 32.5, 33.2, 33.7, 34.7, 35.1, 32.3, 33.4, 32.7, 30.6, 26.9, 31.6, 32.5, 32.0, 31.9, 30.7, 27.6, 27.2, 25.1, 28.5, 28.9, 25.5, 28.4, 30.1, 29.2, 29.0, 29.9, 30.6];
let mut count: i32 = 0;
let mut max: i32 = 0;
for t in temperatures.iter() {
if t > &30.0 {
count += 1;
@smeghead
smeghead / rust-sandbox-read-csv.rs
Created January 26, 2021 04:45
rust-sandbox-read-csv
use std::env;
use std::fs::File;
use std::io::prelude::*;
#[derive(Debug)]
struct Organization<'a> {
id: &'a str,
name: &'a str,
}
fn main() {