Skip to content

Instantly share code, notes, and snippets.

View sei0o's full-sized avatar

Seio Inoue sei0o

  • The University of Tokyo (eeic2023)
  • Tokyo, Japan (UTC+9)
  • 05:02 (UTC +09:00)
View GitHub Profile
@sei0o
sei0o / yamltodir.rb
Last active April 27, 2023 02:57
Turns YAML into a tree of files and directories. Use with fzf, rg, etc.
# usage: ruby yamltodir.rb some.yaml dest_dir
require 'yaml'
require 'fileutils'
def create_files(data, path='')
if data.is_a? Hash
FileUtils.mkdir_p path
data.each do |key, value|
escaped_key = key.gsub('/', '_')
@sei0o
sei0o / slugadd.rb
Created January 13, 2023 17:14
YAML frontmatterを持つMarkdownファイルに、適当なslugを与えるスクリプト
# $ ruby slugadd.rb path/to/dir
dirname = ARGV[0] || '.'
notes = Dir.children dirname
notes.each do |path|
abspath = dirname + "/" + path
# subdirectories and non-Markdown files are ignored
next if File.directory? abspath
next unless abspath.end_with? ".md"
@sei0o
sei0o / init.vim
Created August 19, 2022 04:15
neovim config as of Aug 19, 2022
set completeopt=menuone,noinsert,noselect
set shortmess+=c
"" lightline
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ], [ 'readonly', 'filename', 'modified' ] ],
\ 'right': [
\ [ 'lineinfo' ],
\ [ 'percent' ],
\ [ 'fileencoding', 'filetype']
@sei0o
sei0o / exec.txt
Created June 17, 2022 13:43
Implementation of lists and convenient lambda functions
$ python report-s2-3.py
First(Tuple(true, false)): true
Second(Tuple(true, false)): false
(Cons 4 nil): [4]
x = (Cons 3 (Cons 2 (Cons 1 nil))): [3, 2, 1]
Head x: 3
Tail x: [2, 1]
Head(Tail x): 2
At(0 x): 3
At(1 x): 2
@sei0o
sei0o / pinned.md
Last active June 5, 2022 01:46
profile
<mxfile host="app.diagrams.net" modified="2021-12-17T05:15:45.332Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36" etag="qexJXk8HdKrasymOLlqe" version="15.9.6" type="device"><diagram id="PLOPOj5SmkhTFwGQXCwU" name="Page-1">7V1Ld6M2FP41LKcHxEtaguO0i+nptFm0XfUwMWMzJSbFZJL011cSEhjpOsYMDxdyjhfiAgJ073dfupINe/Xw8mMePe5+zjZxaiBz82LYNwZCloOQwX7m5rWk+MQpCds82YiLasJd8m8siKagPiWb+NC4sMiytEgem8T7bL+P74sGLcrz7Ll52ZcsbT71MdrGGuHuPkp16u/JptiVVIz8mv5TnGx38smWR8ozD5G8WHzJYRdtsucjkr027FWeZUXZenhZxSkbPDku5X23J85WL5bH+6LNDXcPv/z1q/kpSj9+JSj2P/so/u2D+IxD8So/ON7Q7xeHWV7ssm22j9J1TQ3z7Gm/iVmvJj2qr/mYZY+UaFHi17goXgUzo6cio6Rd8ZCKs/FLUvzBbv/BFUd/Hp25eRE984NXcVC+J3u5k58vSIfsKb+P3/hmqxp8KrVx9hAX+Su9L4/TqEi+NfuPhPhsq+uqWz9lCX0yMoWoE8FmIefYNJs9FFG+jQtxU80m2jh6i5rEmXcBI8X7fovSJ/EFxto1Qmxg2vCM0DSIpfG6ycnnXVLEd48RH7xnCucm18QD4ryIX97mgT624ga7OUaWHLPnGlmWhMvuCFWeeZobjYG8dNTwAsUfDSL+yOkm/0GeR69Hlz2yCw7tn2O7ita77HraKN+gVzAiAIw2Q2Jo84ZthCvRCEJ5KpSnbEm5rS+eGrkWvjbokgVC1x4EuvbEpssG0
@sei0o
sei0o / config.fish
Last active December 6, 2021 11:26
some config
if status is-interactive
# Commands to run in interactive sessions can go here
end
zoxide init fish | source
alias ls=exa
xkbcomp ~/.Xkeymap $DISPLAY 2>/dev/null
function cl
cd $argv
@sei0o
sei0o / syllabus.js
Last active September 29, 2021 07:05
MCC移行後の高専カリキュラムを取得する
//
const fs = require("fs")
const path = require("path")
const puppeteer = require("puppeteer")
async function getSyllabus(browser, schoolId, departmentId, year, lang) {
const page = await browser.newPage()
const url = `https://syllabus.kosen-k.go.jp/Pages/PublicSubjects?school_id=${schoolId}&department_id=${departmentId}&year=${year}&lang=${lang}`
@sei0o
sei0o / kochi.fish
Created February 13, 2021 04:01
http://www.ge.kochi-ct.ac.jp/~kyozai/hennyu/ のフォルダを整理する
#!/bin/bash
set B $PWD
set DIR $PWD/www.ge.kochi-ct.ac.jp/~kyozai/hennyu
for year in (seq 100)[8..26]
wget --mirror --no-parent http://www.ge.kochi-ct.ac.jp/~kyozai/hennyu/h{$year}/
end
mv $DIR .
rm -rf www.ge.kochi-ct.ac.jp
import socket
import threading
import time
import cv2
from easytello.stats import Stats
class Tello:
def __init__(self, tello_ip: str='192.168.10.1', debug: bool=True):
# Opening local UDP port on 8889 for Tello communication
self.local_ip = ''