Skip to content

Instantly share code, notes, and snippets.

@fuba
fuba / ud_cos2_server.go
Last active March 2, 2024 14:56 — forked from oquno/udco2s.py
UD-CO2S にシリアル接続してデータを JSON ファイルに上書きし続けるスクリプト を go でサーバにしたやつ
package main
import (
"encoding/json"
"flag"
"fmt"
"io"
"net/http"
"os"
"os/signal"
@fuba
fuba / Client.pm
Created April 10, 2023 19:07
a module generated by chatgpt and copilot
package MastodonLike::Client;
use strict;
use warnings;
use LWP::UserAgent;
use JSON;
use HTTP::Request::Common;
sub new {
@fuba
fuba / init.lua
Created June 7, 2020 12:30
Scrolling by trackball with clicking middle button using Hammerspoon
-- HANDLE SCROLLING
local deferred = false
overrideOtherMouseDown = hs.eventtap.new({ hs.eventtap.event.types.otherMouseDown }, function(e)
--print("down"))
deferred = true
return true
end)
test
@fuba
fuba / jimaku_capture.js
Last active April 5, 2016 16:04
webvtt をcanvas に埋め込むあたり、jQuery が微妙にまざってるのは気にしないでください
// copyFlame を呼ぶと video#player のフレームにそれに対応する時刻の字幕が埋め込まれた canvas cEle ができるデモ
var _copyFrame = function (jimakuText) {
var cEle = document.createElement('canvas');
var vEle = document.getElementById('player'); // video element
cEle.width = vEle.videoWidth;
cEle.height = vEle.videoHeight;
var bottom = cEle.height - 30;
var width = cEle.width;
@fuba
fuba / fix_vlc_snapshot.pl
Last active August 29, 2015 14:19
Fix aspect ratio of vlc 2.2.1 snapshots on Mac OS X
#!/usr/bin/perl
use strict;
use warnings;
my @props = qw/dpiHeight dpiWidth pixelWidth pixelHeight/;
my $file = shift;
chomp $file;
exit if $file !~ /\.tiff$/;
my $outfile = $file;
natsukusaya tsuwamonodomoga yumeno ato
2015-03-07T03:20:38 [DEBUG] root offset 0 at /home/ec/lib/My/Text/FindSenryu.pm line 51
2015-03-07T03:20:38 [DEBUG] trails 0, 5 at /home/ec/lib/My/Text/FindSenryu.pm line 131
2015-03-07T03:20:38 [DEBUG] yomi: natsukusaya 5 at /home/ec/lib/My/Text/FindSenryu.pm line 119
2015-03-07T03:20:38 [DEBUG] 5:アアアアア at /home/ec/lib/My/Text/FindSenryu.pm line 122
2015-03-07T03:20:38 [DEBUG] 5 found, skip kigou at /home/ec/lib/My/Text/FindSenryu.pm line 55
2015-03-07T03:20:38 [DEBUG] _skip_kigou, 1 at /home/ec/lib/My/Text/FindSenryu.pm line 86
2015-03-07T03:20:38 [DEBUG] skip_kigou:  :記号 at /home/ec/lib/My/Text/FindSenryu.pm line 92
2015-03-07T03:20:38 [DEBUG] skip_kigou: tsuwamonodomoga:名詞 at /home/ec/lib/My/Text/FindSenryu.pm line 92
2015-03-07T03:20:38 [DEBUG] skipped kigou, find 7, offset 0 + 1 at /home/ec/lib/My/Text/FindSenryu.pm line 58
package NLPDocument::MeCabNode;
use strict;
use warnings;
use utf8;
use Encode;
use YAML::Syck;
use Lingua::JA::Numbers;
use base qw( Class::Accessor::Fast );
@fuba
fuba / mpegts2h264.sh
Last active August 29, 2015 14:15 — forked from orumin/mpegts2h264.sh
#!/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-9]\[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\.[0-9]\[0x\([0-9a-f][0-9a-f][0-9a-f]\)\].*$/\1/g")
echo $video_sid
@fuba
fuba / test
Created January 27, 2015 08:28
test
public test