Skip to content

Instantly share code, notes, and snippets.

@taC-h
taC-h / onefile.sh
Last active September 14, 2021 14:54
exit 0まではshellスクリプトとして解釈し,#python~#endまでをpythonインタプリタに突っ込むスクリプト
#!/bin/bash
set -eu
function extract(){
cat $0 | awk "/^#end/{if(i)exit} i{print} /^#$1/{i++}"
}
extract "python" | python3
exit 0
#python
@taC-h
taC-h / csv.sh
Created May 25, 2021 04:49
gnuplotで出力
OUT=${2:-"$1.png"}
if [ -z $1 ];then
echo "no input file"
exit 1
fi
if [ $# -gt 2 ];then
echo "too many input"
exit 1
fi
echo $OUT
@taC-h
taC-h / girlnote323-contains-dunder.py
Last active May 23, 2021 12:22
数学ガールの秘密ノート 第323回 片方向循環リスト Pythonでの実装2
from __future__ import annotations
from typing import Optional
from functools import reduce
class Node:
def __init__(self, value: int, next: Optional[Node]):
self.value = value
self.next = next
@taC-h
taC-h / girlnote323-contains.py
Last active May 16, 2021 10:03
数学ガールの秘密ノート 第323回 片方向循環リスト Pythonでの実装1
from __future__ import annotations
from typing import Optional
class Node:
def __init__(self, value: int, next: Optional[Node]):
self.value = value
self.next = next