Skip to content

Instantly share code, notes, and snippets.

@penguin2716
penguin2716 / pdf2outline.sh
Created August 1, 2016 04:42
convert a PDF file to outline PDF
#!/bin/bash
if [ "x$1" = "x" -o "x$2" = "x" ]; then
echo Usage: `basename "$0"` "<input.pdf>" "<output.pdf>" >&2
exit 1
fi
# change 'ps2write' to 'pswrite' if errors
gs -sDEVICE=ps2write -dNOCACHE -sOutputFile=- -q -dbatch \
-dNOPAUSE -dQUIET "$1" -c quit | ps2pdf - "$2"
@penguin2716
penguin2716 / masquerade-curry-ukiuki.rb
Created February 13, 2016 09:55
マスカレード・カレー・ウキウキ
# coding: utf-8
Plugin.create :masquerade_curry_ukiuki do
Thread.new {
loop do
Plugin.call(:update, nil, [Message.new(:message => "マスカレード・カレー・ウキウキ", :system => true)])
sleep 120
end
}
end
@penguin2716
penguin2716 / mikutter_jins_pc.rb
Created March 19, 2013 09:08
JINS PCに対応するためのmikutterプラグイン
#-*- coding: utf-8 -*-
Plugin.create :jins_pc do
filter_message_background_color do | mp, color |
# 青成分を50%カット
[mp, [color[0],color[1],(color[2] * 0.5).to_i]]
end
end
@penguin2716
penguin2716 / conoha.rb
Last active January 6, 2016 11:44
ConoHaのAPIを簡単に叩くためのスクリプト.環境変数に必要な認証情報をセットして使ってね.
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
require 'net/http'
require 'uri'
require 'json'
require 'pp'
require 'optparse'
PRINT_CREDENTIALS = false
@penguin2716
penguin2716 / auto_wget_img.rb
Last active January 4, 2016 10:58
まとめサイトとかから自動で画像をwgetしてくれるRubyスクリプト
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
=begin
Auto wget image
Copyright (c) 2014 Takuma Nakajima
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
@penguin2716
penguin2716 / vimlike_textview.rb
Created January 1, 2014 12:29
vimlike_textview for mikutter (development preview)
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
require 'gtk2'
require 'gtksourceview2'
class VimlikeTextView < Gtk::SourceView
attr_accessor :current_mode, :default_bgcolor, :insert_bgcolor, :visual_bgcolor, :select
@penguin2716
penguin2716 / colorize_postbox_basecolor.rb
Created December 31, 2013 12:11
フォーカスの有無によって投稿ボックスの背景色を変更するmikutterプラグイン
#-*- coding: utf-8 -*-
require 'gtk2'
Plugin.create :colorize_textview_base do
UserConfig[:normal_basecolor] ||= [0xffff, 0xffff, 0xffff]
UserConfig[:focused_basecolor] ||= [0xffff, 0xffff, 0xbbbb]
settings "投稿ボックスの背景色" do
settings "色の設定" do
@penguin2716
penguin2716 / mikutter_shout.rb
Created December 26, 2013 12:08
叫ぶmikutterプラグイン
# -*- coding: utf-8 -*-
Plugin.create :mikutter_shout do
@candidates = "あうえおぁぅぇぉw!".split("")
command(:shout,
name: '叫ぶ',
condition: lambda{ |opt| true },
visible: true,
role: :postbox) do |opt|
@penguin2716
penguin2716 / mikutter_post_with_footer.rb
Created December 8, 2013 04:55
適当なキーバインドのときにフッタをつけてつぶやくためのmikutterプラグイン(設定画面からフッタ文字列を追加してね)
#-*- coding: utf-8 -*-
Plugin.create :post_with_footer do
UserConfig[:post_with_footer_footer] ||= ""
command(:post_with_footer,
name: 'フッタをつけてツイート',
condition: lambda{ |opt| Plugin.create(:gtk).widgetof(opt.widget).widget_post.buffer.text.size > 0 },
visible: true,
role: :postbox) do |opt|
@penguin2716
penguin2716 / update-hostname.sh
Last active December 30, 2015 00:48
a script for updating hostname and /etc/hosts
#!/bin/bash
if [ $USER != "root" ]; then
echo "root permission required"
exit 1
fi
if [ $# -eq 0 ]; then
echo "usage: $0 <fqdn> [<hosts_file>]"
exit 1