Skip to content

Instantly share code, notes, and snippets.

@fuba
fuba / init.lua
Created Jun 7, 2020
Scrolling by trackball with clicking middle button using Hammerspoon
View init.lua
-- HANDLE SCROLLING
local deferred = false
overrideOtherMouseDown = hs.eventtap.new({ hs.eventtap.event.types.otherMouseDown }, function(e)
--print("down"))
deferred = true
return true
end)
@fuba
fuba / jimaku_capture.js
Last active Apr 5, 2016
webvtt をcanvas に埋め込むあたり、jQuery が微妙にまざってるのは気にしないでください
View jimaku_capture.js
// 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 Aug 29, 2015
Fix aspect ratio of vlc 2.2.1 snapshots on Mac OS X
View fix_vlc_snapshot.pl
#!/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;
View gist:dedc15010c38cbe3420e
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
View gist:135f3459e9104d40f4c4
package NLPDocument::MeCabNode;
use strict;
use warnings;
use utf8;
use Encode;
use YAML::Syck;
use Lingua::JA::Numbers;
use base qw( Class::Accessor::Fast );
View 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
View test
public test
View gist:b010b001dfa35b78f081
% cat /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="9025", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="d00d", GROUP="plugdev"
View gist:70fb320094124bed42eb
[chimaira:~] ec% curl -s -I http://gunosy.com/g/R99De | egrep '^HTTP'
HTTP/1.1 200 OK
[chimaira:~] ec% curl -s -I http://gunosy.com/g/R99De | egrep '^HTTP'
HTTP/1.1 200 OK
[chimaira:~] ec% curl -s -I http://gunosy.com/g/R99De | egrep '^HTTP'
HTTP/1.1 200 OK
[chimaira:~] ec% curl -s -I http://gunosy.com/g/R99De | egrep '^HTTP'
HTTP/1.1 200 OK
[chimaira:~] ec% curl -s -I http://gunosy.com/g/R99De | egrep '^HTTP'
HTTP/1.1 302 Found
You can’t perform that action at this time.