Skip to content

Instantly share code, notes, and snippets.

@penguin2716
penguin2716 / mikutter_security_crash.rb
Last active August 29, 2015 14:07
自分で "abort-mikutter" とツイートすると,mikutterをリモートで終了させるmikutterプラグイン
#-*- coding: utf-8 -*-
Plugin.create :security_crash do
# キーワードを設定
UserConfig[:security_crash_keyword] ||= 'abort-mikutter'
# TLに流れてきたすべてのツイートを監視
on_appear do |ms|
ms.each do |m|
# 投稿者が自分で,上記のキーワードと一致しているか確認
@penguin2716
penguin2716 / 60_warnning.zsh
Created July 8, 2014 10:36
source this script in your ~/.bashrc and stop using deprecated package
#!/usr/bin/env zsh
function arp {
echo "use 'ip n' instead."
return 1
}
function ifconfig {
echo "use 'ip a (ip addr)', 'ip link', or 'ip -s (ip -stats)' instead."
return 1
@penguin2716
penguin2716 / mikutter_yo.rb
Created June 20, 2014 15:02
「よ」を「Yo」に書き換えてからツイートするmikutterプラグイン
# -*- coding: utf-8 -*-
Plugin.create :mikutter_yo do
filter_gui_postbox_post do |gui_postbox|
text = Plugin.create(:gtk).widgetof(gui_postbox).widget_post.buffer.text.gsub(/よ/, "Yo")
Service.primary.post :message => text
Plugin.call(:before_postbox_post, text)
Plugin.create(:gtk).widgetof(gui_postbox).widget_post.buffer.text = ''
Plugin.filter_cancel!
@penguin2716
penguin2716 / mba_autobl.rb
Last active August 29, 2015 14:02
Automatically adjusts the display brightness of MacBook Air (requires mba6x_bl)
#!/home/penguin/local/ruby/bin/ruby
#
# Copyright (c) 2014 Takuma Nakajima
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
#
# ambient light sensor
ALS_SOURCE = '/sys/devices/platform/applesmc.768/light'
@penguin2716
penguin2716 / 50-mtrack.conf
Last active August 29, 2015 14:02
a part of /etc/X11/xorg.conf.d/50-mtrack.conf (and add "xset m 40/10" to your .xprofile)
Section "InputClass"
Identifier "touchpad catchall"
Driver "mtrack"
MatchIsTouchpad "on"
EndSection
Section "InputClass"
# available options: https://github.com/BlueDragonX/xf86-input-mtrack
Identifier "Multitouch driver settings"
MatchProduct "Apple|bcm5974"
@penguin2716
penguin2716 / autoinstall_mikutter_ubuntu1404.sh
Created May 19, 2014 16:37
Installation procedure of latest mikutter 3.0.0 for Ubuntu 14.04
#!/bin/bash
# This script will install mikutter 3.0.0 (currently testing release)
# to your fresh Ubuntu 14.04 environment (tested on Server LTS amd64 via ssh -YC)
# install depends
sudo apt-get update
sudo apt-get install ruby2.0 ruby2.0-dev git libgtk2.0-dev fonts-vlgothic
# checkout latest mikutter branch
@penguin2716
penguin2716 / hello.sh
Created May 8, 2014 03:27
"Hello, world!"と表示するシェルスクリプト(for 64bit Linux)
This file has been truncated, but you can view the full file.
#!/bin/bash
perl -e 'while (<>) { print pack("H*",$_); }' <<EOF > hello
7f454c4602010103000000000000000002003e0001000000e0034000000000004000000000000000d0970b000000000000000000400038000700400020001d00010000000500000000000000000000000000400000000000000040000000000026720b000000000026720b000000000000002000000000000100000006000000187f0b0000000000187f6b0000000000187f6b00000000001817000000000000a03f00000000000000002000000000000400000004000000c801000000000000c801400000000000c8014000000000002000000000000000200000000000000004000000000000000700000004000000187f0b0000000000187f6b0000000000187f6b000000000020000000000000005000000000000000080000000000000051e574640600000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000052e5746404000000187f0b0000000000187f6b0000000000187f6b0000000000e800000000000000e80000000000000001000000000000008015046500280000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000040000001000000001000000474e55000000000
@penguin2716
penguin2716 / hello.sh
Created May 8, 2014 03:05
"Hello, world!"と出力するシェルスクリプト
#!/bin/bash
cat <<EOF > hello.c
#include <stdio.h>
int main(void) {
printf("Hello, world!\n");
return 0;
}
EOF
gcc -o hello hello.c
@penguin2716
penguin2716 / mikutter_fav_all_accounts.rb
Created May 7, 2014 13:27
全部のアカウントでふぁぼるmikutterプラグイン(mikutter>=3.0.0)
# -*- coding: utf-8 -*-
Plugin.create :fav_all_accounts do
proc = Plugin.filtering(:command, Hash.new).first[:account_forward][:exec]
command(:fav_all_accounts,
name: '全部のアカウントでふぁぼる',
condition: lambda{ |opt| true },
visible: true,
role: :timeline) do |opt|
@penguin2716
penguin2716 / mselect.rb
Created February 11, 2014 19:23
list/select and rewrite ~/.mikutter symlink
#!/usr/bin/env ruby
FLOATING_PATH = File.join(ENV["HOME"], ".mikutter")
FLOATING_PATH_DIR = File.dirname(FLOATING_PATH)
FLOATING_PATH_BASE = File.basename(FLOATING_PATH)
if File.exists? FLOATING_PATH and not File.symlink? FLOATING_PATH
puts "error: #{FLOATING_PATH} exists but not a symlink"
exit 1
end