Skip to content

Instantly share code, notes, and snippets.

@penguin2716
penguin2716 / gradus_ad_parnassum.sh
Created Oct 23, 2013
Gradus Ad Parnassum by Debussy (with beep command)
View gradus_ad_parnassum.sh
#!/bin/bash
# Gradus Ad Parnassum by Debussy (with beep command)
if [ $USER != 'root' ]; then
echo "beep command requires root permission!"
exit 1
fi
modprobe pcspkr
@penguin2716
penguin2716 / signaling.rb
Last active Dec 24, 2015
メソッド呼ばれた時とかにsignaling_emitしてsingnaling_connectで登録されたメソッドを叩けると便利じゃね
View signaling.rb
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
require 'securerandom'
require 'socket'
require 'zlib'
module Signaling
def debug(message)
View modify_font_instance_sample.rb
#!/usr/bin/env ruby
require 'gtk2'
module Gtk
class Foo < Gtk::TextView
def update_font(str)
self.modify_font(Pango::FontDescription.new(str))
end
end
View modify_font_sample.rb
#!/usr/bin/env ruby
require 'gtk2'
w = Gtk::Window.new
w.set_size_request(300,200)
tv = Gtk::TextView.new
tv.modify_font(Pango::FontDescription.new("Sans bold 18"))
@penguin2716
penguin2716 / LibvirtComputingResource.java.patch
Last active Dec 22, 2015
I want to test PCI pass-through on CloudStack 4.1.x, KVM Host!!!
View LibvirtComputingResource.java.patch
--- plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java.orig 2013-09-13 05:57:43.217108879 +0900
+++ plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java 2013-09-13 06:00:49.025120076 +0900
@@ -3091,6 +3091,7 @@
DevicesDef devices = new DevicesDef();
devices.setEmulatorPath(_hypervisorPath);
+ devices.setDomainName(vmTO.getName());
SerialDef serial = new SerialDef("pty", null, (short) 0);
devices.addDevice(serial);
@penguin2716
penguin2716 / pa
Last active Dec 22, 2015
諸事情により他人の権限でaptを叩くことになりました
View pa
#!/bin/bash
# package agent script
# you can run apt command by other user's permission.
set -e
PASSWORD_FILE=$HOME/.pa/password
USERNAME_FILE=$HOME/.pa/username
@penguin2716
penguin2716 / each.rb
Last active Dec 21, 2015
I want to play my mp3 files in random order!
View each.rb
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
# I want to play my music files in random order!
# command example:
# find . -name '*.ogg' | sort -R | each.rb mplayer -cache 1024 {}
# I didn't know the command above can be replaced to...
# find . -name '*.ogg' -print0 | sort -z -R | xargs mplayer -cache 1024
@penguin2716
penguin2716 / empty_majide_filter.rb
Created Jun 16, 2013
空リプ飛ばそうとすると「まっじで!」になっちゃうmikutterプラグイン
View empty_majide_filter.rb
# -*- coding: utf-8 -*-
Plugin.create :empty_majide_filter do
filter_gui_postbox_post do |gui_postbox|
text = Plugin.create(:gtk).widgetof(gui_postbox).widget_post.buffer.text
if text =~ /^(@[a-zA-Z0-9_]+)\s*$/i
Plugin.create(:gtk).widgetof(gui_postbox).widget_post.buffer.text = $1 + " まっじで!"
end
[gui_postbox]
end
@penguin2716
penguin2716 / json_sample.rb
Created Jun 1, 2013
JSONなAPIを叩くようなやつ
View json_sample.rb
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
# http:// から始まるURLをopenできるようにする
require 'open-uri'
# JSONをHashに変換するために必要
require 'json'
# APIのベースとなるURL
BASE_URL = "http://zipcloud.ibsnet.co.jp/api/search?zipcode="
@penguin2716
penguin2716 / icon.png
Last active Dec 16, 2015
mikutterの薄い本製作委員会へのリンク