Skip to content

Instantly share code, notes, and snippets.

@oflow
oflow / devtools-toggle-toolbarbutton.uc.js
Created November 15, 2017 08:03
開発ツールを開くボタンがツールバーにあればFirebug必要ないのでは
// ==UserScript==
// @name DevTools Toggle Toolbarbutton
// @version 1.0
// ==/UserScript==
(function() {
CustomizableUI.createWidget({
id: 'ucjs-devtools-toggle-button',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
@oflow
oflow / msys-zsh.md
Last active November 7, 2017 14:18
そんなことかよ!

MSYS2のzsh-5.2以降でUnicode絵文字が化けていたのはzsh-5.1.1-1に戻すと直る。

pacman -U /var/cache/pacman/pkg/zsh-5.1.1-1-x86_64.pkg.tar.xz
String.fromCharCode(115,97,109,117,105)
@oflow
oflow / syosetu.sh
Created August 20, 2017 13:11
保存するやつ。sleep 入れないと怒られる。
#!/bin/sh
url=http://ncode.syosetu.com/txtdownload/dlstart/ncode
id=651272
for i in `seq 1 242`
do
f=`printf %03d $i`
wget "$url/$id/?no=$i&code=utf-8&hankaku=0" -O $f.txt
@oflow
oflow / gulp-task-completion.zsh
Last active July 21, 2017 09:11
gulp はタスク名を補完しろよ
compdef _gulp gulp
function _gulp () {
local -a task
if [ -f ./gulpfile.js ]; then
task=(`cat gulpfile.js | grep "task('" | awk -F\' '{ print $2 }' | tr '\n' ' '`)
compadd $task
else
zle -M 'No gulpfile found'
fi
}
@oflow
oflow / tmux-2.5-fix.patch
Created June 6, 2017 06:39
tmux-2.5でEast Asian Ambiguous Characterを全角文字の幅で表示するやつと半角ボーダーをまとめたやつ
diff -uprN tmux-2.5/options-table.c tmux-2.5-patched/options-table.c
--- tmux-2.5/options-table.c 2017-05-29 16:08:04.000000000 +0900
+++ tmux-2.5-patched/options-table.c 2017-06-06 13:30:20.390849587 +0900
@@ -129,6 +129,14 @@ const struct options_table_entry options
.separator = ","
},
+#ifndef NO_USE_UTF8CJK
+ { .name = "utf8-cjk",
+ .type = OPTIONS_TABLE_FLAG,
lazy-load使うならJavaScript無効の時に表示されるようにnoscriptタグも使えボケ
お前のサイトのスクリプトなんか許可したくねーんだよ!
<img class="lazy" data-src="元画像">
<noscript>
<img src="元画像">
</noscript>
@oflow
oflow / egid.js
Last active May 5, 2017 11:59
egid
'use strict';
var client = require('cheerio-httpcli'),
fs = require('fs'),
co = require('co'),
ev = '',
act = 3;
client.setBrowser('chrome');
@oflow
oflow / _zopfli.zsh
Created February 15, 2017 06:33
雑なzopfli補完
compdef _zopfli zopfli
function _zopfli() {
_arguments \
'-h[help]' \
'-c[write the result on standard output]' \
'-v[verbose mode]' \
'--i#[perform # iterations (default 15). Expamples --i50]' \
'--gzip[output to gzip format (default)]' \
'--zlib[output to zlib format]' \
'--deflate[output to deflate format]' \
@oflow
oflow / .zshrc
Created January 24, 2017 03:46
tmuxでdetachしたやつが1つだけあった場合は自動でattachする。それ以外はlist-sessionsで一覧表示
if [ -z $TMUX ] && [ `tmux list-sessions | grep -v 'attached' | wc -l` -eq 1 ]; then
tmux attach -t `tmux list-sessions | grep -v 'attached' | awk -F: '{print $1}'`
else
w
if [ -z $TMUX ]; then
echo -e "\ntmux sessions"
tmux list-sessions
fi
fi