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 / 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
@kkosuge
kkosuge / resize_for_gplus.rb
Created July 31, 2011 09:24
Google+に参加して無料Picasaの無限アップロード
require 'rubygems'
require 'rmagick'
width = 2048
height = 2048
Dir.mkdir("./resized") unless Dir.exist?("./resized")
files = Dir.entries("./")
files.each_with_index do |file,index|
# 配列風の文字列を配列にする方法
str = "[1,'hoge']"
ary = eval(str) #怖い....
ary = str[1..-2].split(',')
# なんかいい方法ないかな
use strict;
use warnings;
use Config::Pit;
use Net::Twitter::Lite;
use DateTime;
use Encode;
use utf8;
my $now = DateTime->now;