Skip to content

Instantly share code, notes, and snippets.

@orumin
orumin / 00_nandgame.com_answer.adoc
Last active April 15, 2024 18:14
Optimal answer for Nandgame.com

Invert

01 inv

And

02 and

Or

#!/bin/bash
# clear
iptables -F
iptables -X
iptables -Z
iptables -t nat -F
iptables -t mangle -F
# setting policy
;;; -*- coding: utf-8 -*-
;; okuri-ari entries.
つもあがt /ツモ和了;[麻雀]/
つもあがr /ツモ和了;[麻雀]/
つもt /自摸;[麻雀]/
つもt /ツモ;[麻雀]/
つもr /自摸;[麻雀]/
つもr /ツモ;[麻雀]/
くいながs /喰い流;[麻雀]/
くいなおs /喰い直;[麻雀]/
@orumin
orumin / get.rb
Last active June 22, 2023 01:13
#!/usr/bin/env ruby
# encoding: utf-8
#
# Web Archiveからスクレイピングして小説家になろうのテキストダウンロードと同じ形式でテキストパクってくるヤツ
#
require 'nokogiri'
require 'open-uri'
@orumin
orumin / mpegts2h264.sh
Last active February 10, 2023 09:25
MPEG2-TS to H.264 within gstreamer on RaspberryPi
#!/usr/bin/bash
#
# Usage: mpegts2h264.sh <src.ts> <dst.mp4>
#
program_no=$(ffmpeg -i $1 2>&1 | grep Program | head -n 1 | awk '{ print $2 }')
video_sid=$(ffmpeg -i $1 2>&1 | grep Stream | grep Video | sed -e "s/^.*Stream #0:0\[0x\([0-9a-f][0-9a-f][0-9a-f]\)\].*$/\1/g")
audio_sid=$(ffmpeg -i $1 2>&1 | grep Stream | grep Audio | sed -e "s/^.*Stream #0:1\[0x\([0-9a-f][0-9a-f][0-9a-f]\)\].*$/\1/g")
gst-launch-1.0 filesrc location=./$1 ! progressreport ! \
port=0
interface=enp8s0
bind-interfaces
dhcp-range=192.168.0.50,192.168.0.150,12h
enable-tftp
dhcp-match=set:efi-x86_64,option:client-arch,7
dhcp-boot=tag:efi-x86_64,grubx64.efi
tftp-root=/tmp/tftpboot
@orumin
orumin / get_logos.sh
Last active January 4, 2022 12:04
mirakc: 局ロゴ取得
#!/bin/sh
services=`curl -sSL http://localhost:40772/api/services`
len=`echo $services | jq length`
cat<<EOF > config_logo.yml
resource:
logos:
EOF
#!/usr/bin/env ruby
# encoding: utf-8
#
# Web Archiveからスクレイピングして小説家になろうのテキストダウンロードと同じ形式でテキストパクって,
# 更にそれをnarou.rbの本文のyaml形式で出力するやつ(実行場所の一階層上のディレクトリにtoc.yamlという目次があるものとする)
#
require 'yaml'
require 'nokogiri'
#!/usr/bin/env ruby
# encoding: utf-8
#
# Web Archiveからスクレイピングして小説家になろうの目次ページをnarou.rbのtoc.yamlと同じ形式で出力するやつ
#
require 'yaml'
require 'nokogiri'
require 'open-uri'
@orumin
orumin / avrdude.sh
Last active April 4, 2021 08:53 — forked from nyomo/avrdude.sh
WSLでavrdudeを簡単に使う為の奴
#!/bin/bash
if [ $# != 1 ]; then
echo "usage: $0 <target firmware>.hex"
exit 0
fi
read -p "target file is $1. correct? [Yn] " yn
case "$yn" in
"" | [yY]*);;