Skip to content

Instantly share code, notes, and snippets.

View yantene's full-sized avatar
:fishsticks:
I'm new to being human.

Shuhei YOSHIDA yantene

:fishsticks:
I'm new to being human.
View GitHub Profile
@yantene
yantene / 60-keyboard.hwdb
Last active October 22, 2023 02:25
/etc/udev/hwdb.d/60-keyboard.hwdb
# Check keycode by `sudo showkey --scancodes` and `sudo evtest /dev/input/event3`
# Execute `sudo udevadm hwdb --update` and reboot
evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadX280* # ThinkPad X280
KEYBOARD_KEY_3a=leftctrl # Caps Lock -> Left Ctrl
KEYBOARD_KEY_1d=leftmeta # Left Ctrl -> Left Super
KEYBOARD_KEY_38=muhenkan # Left Alt -> Muhenkan
KEYBOARD_KEY_b8=henkan # Right Alt -> Henkanmode
KEYBOARD_KEY_9d=rightalt # Right Ctrl -> Right Alt
newtrack(piano) {
ch = 1
l = 480
du = 9
v = 60
}
newtrack(percussion) {
ch = 10
l = 480
du = 9
# Maintainer: yantene <contact at yantene.net>
pkgname=takt
pkgver=0.310
pkgrel=1
pkgdesc="A text-based music programming language designed by Satoshi Nishimura"
arch=('x86_64')
url="http://takt.sourceforge.net/"
license=('GPL' 'LGPL')
depends=('readline' 'alsa-lib')
@yantene
yantene / icmp_echo_message.rb
Last active March 21, 2020 15:35
Ruby で ping を行うプログラムです. 嘘つきました.応答の受信機能はありません.
require 'socket'
class ICMPEchoMessage
TYPE = 0x08
CODE = 0x00
def initialize(id = rand(0..0xffff))
@id = id.freeze
@seq = 0x0000

Kagoya で適当にサーバ立てる

ISO イメージアップロード

Ubuntu Server 18.04.2 LTS をベースに考える。

https://ubuntu.com/download/server

以下で ISO イメージアップロード

class Array
def flat_pack
self.flat_map { |c| Range === c ? c.to_a : c }.map { |c| [c].pack('U*') }
end
end
Hentaigana = {
'あ' => [0x1b002..0x1b005].flat_pack,
'い' => [0x1b006..0x1b009].flat_pack,
'う' => [0x1b00a..0x1b00e].flat_pack,
@yantene
yantene / ju_solver.rb
Last active February 17, 2019 13:34
10つくったー (https://shindanmaker.com/217387) ソルバ
#!/usr/bin/env ruby
# ./ju_solver.rb 13 9 -3 73
ARGV.map(&:to_i).then { |ord|
%i[+ - * /].repeated_combination(ord.size - 1).flat_map { |orr|
(ord + orr).permutation((ord + orr).size).map { |formula|
begin
formula if formula.each.with_object([]) { |v, obj|
if v.is_a? Symbol
fail if obj.size < 2 || v == :/ && obj[-1].zero?
@yantene
yantene / Dockerfile.sandbox
Last active October 31, 2018 09:10
`docker build -t yantene/sandbox /path/to/dockerfiledir` and `docker run --rm -it -v `pwd`:/mnt -p 10022:22 yantene/sandbox`
FROM base/devel
MAINTAINER yantene <contact@yantene.net>
# ユーザ作成
RUN \
useradd -m -g users -G wheel username;\
echo "username:password" | /usr/bin/chpasswd
RUN \
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel;\
chmod 0440 /etc/sudoers.d/wheel
#!/usr/bin/env ruby
braille = <<~EOS
⠀⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏
⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙⡚⡛⡜⡝⡞⡟
⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯
⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷⠸⠹⠺⠻⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿
⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏
⢐⢑⢒⢓⢔⢕⢖⢗⣐⣑⣒⣓⣔⣕⣖⣗⢘⢙⢚⢛⢜⢝⢞⢟⣘⣙⣚⣛⣜⣝⣞⣟
⢠⢡⢢⢣⢤⢥⢦⢧⣠⣡⣢⣣⣤⣥⣦⣧⢨⢩⢪⢫⢬⢭⢮⢯⣨⣩⣪⣫⣬⣭⣮⣯
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.