Skip to content

Instantly share code, notes, and snippets.

View kkosuge's full-sized avatar
🐇
busy

Kosuge Kazuya kkosuge

🐇
busy
View GitHub Profile
@kkosuge
kkosuge / randread.fio
Last active August 29, 2015 14:23
IOPS (ConoHa v2 4G + 500GB SSD)
[global]
ioengine=libaio
direct=1
invalidate=1
group_reporting
directory=/home
filename=test.bin
runtime=60
[Rand-Read-4k-qd32]
window.pp = (object) -> console.log JSON.stringify(object, null, 2)
@kkosuge
kkosuge / barby_codabar.rb
Last active September 7, 2015 11:34
Codabar(NW-7)のバーコードを生成する barby gem のモジュール
require 'barby'
require 'barby/barcode'
require 'barby/barcode/code_128'
require 'barby/outputter/ascii_outputter'
require 'barby/outputter/png_outputter'
require 'pry'
require 'pp'
module Barby
class Codabar < Barcode1D
@kkosuge
kkosuge / kksgyazo.rb
Created June 19, 2011 05:28
sinatraの簡易Gyazoサーバー
#coding: utf-8
require 'sinatra'
require 'digest/md5'
# 個人用なのでいろいろ削った
# オリジナルとクライアントのソース
# https://github.com/gyazo/Gyazo
post '/example/example/example' do
imagedata = params['imagedata'][:tempfile].read
@kkosuge
kkosuge / rename_images.pl
Created June 22, 2011 14:33
画像ファイルのヘッダ見て拡張子つけてくれるやつ。カレントディレクトリにある全てのそれっぽい画像ファイルに操作する。
use strict;
use warnings;
my @file = glob "*";
foreach my $f (@file){
if($f=~/(.*)\.(.*)/){
unless($2=~/jpg|png|gif|bmp|svg/){
&rename_img($f);
}
}
@kkosuge
kkosuge / delete_followers.rb
Created June 22, 2011 15:17
フォローしてないフォロワー全部ブロックするやつ
require "rubygems"
require "twitter"
Twitter.configure do |config|
config.consumer_key = YOUR_CONSUMER_KEY
config.consumer_secret = YOUR_CONSUMER_SECRET
config.oauth_token = YOUR_OAUTH_TOKEN
config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end
@kkosuge
kkosuge / twitter_profile_transparent.js
Created June 26, 2011 06:17
twitterのサイドバーとか透明に設定させるやつ
// https://twitter.com/settings/design でブラウザのURL入ってるとこに入れて保存する
// サイドバーと背景は透明になるけど流石にfontは消えなかった。transparentとか指定しても弾かれる
javascript:d=document;d.getElementById("user_profile_sidebar_fill_color").value = '';d.getElementById("user_profile_sidebar_border_color").value = '';d.getElementById("user_profile_text_color").value = '';d.getElementById("user_profile_background_color").value = '';d.getElementById("user_profile_link_color").value = '';void(0);
//chromeのURLバーに入れてもjavascript実行できなくなった。
//ブックマークレットにして使った方がよさそう。
javascript:d=document;d.getElementById("user_profile_sidebar_fill_color").value = '';d.getElementById("user_profile_sidebar_border_color").value = '';void(0);
number_to_currency(3980000, :unit => "円", :format => "%n%u", :precision => 0)
#=> 3,980,000円
@kkosuge
kkosuge / gist:1071982
Created July 8, 2011 14:39
false_nyan.rb
class Nyan
attr_accessor :piyo
def test
p piyo
if false
p "in!!!!!!!!!!!!!!"
piyo = "wan!!"
end
p piyo
@kkosuge
kkosuge / favter.rb
Created July 23, 2011 09:51
favorit爆撃を与えてターゲットのデスクトップをGrowlで埋めるなどします
#coding: utf-8
require 'twitter'
Twitter.configure do |config|
config.consumer_key = YOUR_CONSUMER_KEY
config.consumer_secret = YOUR_CONSUMER_SECRET
config.oauth_token = YOUR_OAUTH_TOKEN
config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
end