Skip to content

Instantly share code, notes, and snippets.

@MasWag
MasWag / water_boiler.tex
Created October 16, 2023 06:36
A PTA modeling a water boiler
\documentclass{standalone}
\usepackage{amssymb,amsmath}
\usepackage{tikz}
\usepackage{mathtools}
\usetikzlibrary{automata,positioning,matrix,shapes.callouts}
\tikzstyle{every node}=[initial text=]
%%% Color setting
\definecolor{coloract}{rgb}{0.50, 0.70, 0.30}
\definecolor{colorclock}{rgb}{0.4, 0.4, 1}
\definecolor{colorloc}{rgb}{0.4, 0.4, 0.65}
FROM --platform=linux/amd64 ubuntu:18.04
# ModelSim requires i386 support
RUN dpkg --add-architecture i386
# Install required packages
RUN apt-get update && \
apt-get install -y xserver-xorg x11-apps \
locales libglib2.0-0 libfreetype6 \
libsm6 libxrender1 libfontconfig1 libxext6 xinit \
@MasWag
MasWag / share.css
Last active August 20, 2023 13:58
Share buttons for Hugo based on https://aakira.app/blog/2018/08/share/
.sns_parent {
text-align: center;
}
.sns_section {
display: inline-block;
text-align: left;
}
.sns_button {
float: left;
Start learning of no-invariant TA
[2023-08-18 18:25:20.038941] [0x00007ff84b102640] [info] Target DTA
digraph G {
loc0 [init=true, match=false]
loc1 [init=false, match=true]
loc0->loc1 [label="b", guard="{x1 <= 20, x1 >= 20}", reset="{x0 := 0}"]
loc0->loc0 [label="a", guard="{x0 <= 3, x0 >= 3}", reset="{x0 := 0}"]
}
[2023-08-18 18:25:20.042653] [0x00007ff84b102640] [info] Complement of the target DTA
@MasWag
MasWag / dynamic-vs-lexical-binding.el
Created June 25, 2023 04:18
Brief example showing dynamic binding and lexical binding in Emacs Lisp
;;; Brief example showing dynamic binding and lexical binding in Emacs Lisp (Comments are in Japanese)
;;; Lines staring with ";>" show the output produced in the REPL.
;; lexical bindingを無効化してdynamic bindingを使う
(setq lexical-binding nil)
;> nil
(defun retcl (x)
(lambda () (+ x 1)))
;> retcl
@MasWag
MasWag / PKGBUILD
Created April 26, 2023 23:42
PKGBUILD for open-usp-tukubai
# Maintainer: Masaki Waga <masakiwaga@gmail.com>
# Contributor: Tatsunori Aoki <ginjiro.135@gmail.com>
DLAGENTS='https::/usr/bin/curl --insecure -fLC - --retry 3 --retry-delay 3 -o %o %u'
pkgname=open-usp-tukubai
pkgver=20230322
pkgrel=1
pkgdesc="An open source version of shell commands usp Tukubai."
arch=('any')
smartctl 7.3 2022-02-28 r5338 [Darwin 22.4.0 x86_64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Number: APPLE SSD AP1024N
Serial Number: C020466013UPCRJ1F
Firmware Version: 1296.100
PCI Vendor/Subsystem ID: 0x106b
IEEE OUI Identifier: 0x000000
Controller ID: 0
smartctl 7.3 2022-02-28 r5338 [Darwin 22.4.0 x86_64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Number: APPLE SSD AP1024N
Serial Number: C020466013UPCRJ1F
Firmware Version: 1296.100
PCI Vendor/Subsystem ID: 0x106b
IEEE OUI Identifier: 0x000000
Controller ID: 0
#!/bin/bash -u
function finish {
hours=$((elapsed / 3600))
minutes=$(((elapsed % 3600) / 60))
seconds=$((elapsed % 60))
if [ $hours -gt 0 ]; then
time_string="$hours 時間 $minutes 分 $seconds 秒"
elif [ $minutes -gt 0 ]; then
@MasWag
MasWag / stopwatch.org
Created February 3, 2023 04:06
(Generated by ChatGPT) A shell script of stopwatch

Stopwatch Shell Script

This is a shell script that acts as a stopwatch. It outputs the elapsed time in hours, minutes, and seconds since the script was started. When the script is stopped by pressing Ctrl + C, it uses the “say” command to speak the elapsed time out loud.

#!/bin/bash

function finish {
  hours=$((elapsed / 3600))
  minutes=$(((elapsed % 3600) / 60))