Skip to content

Instantly share code, notes, and snippets.

View gomasy's full-sized avatar

Gomasy gomasy

View GitHub Profile
1.upto(100) { |i|
print i % 15 == 0 ? "Fizz Buzz, ":i % 3 == 0 ? "Fizz, ":i % 5 == 0 ? "Buzz, ":"#{i}, "
}
@gomasy
gomasy / fizzbuzz.txt
Created December 11, 2013 05:56
ruby -e '1.upto(100) { |i|' -e 'print i % 15 == 0 ? "Fizz Buzz, ":i % 3 == 0 ? "Fizz, ":i % 5 == 0 ? "Buzz, ":"#{i}, "' -e '}' > fizzbuzz.txt
1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz, 11, Fizz, 13, 14, Fizz Buzz, 16, 17, Fizz, 19, Buzz, Fizz, 22, 23, Fizz, Buzz, 26, Fizz, 28, 29, Fizz Buzz, 31, 32, Fizz, 34, Buzz, Fizz, 37, 38, Fizz, Buzz, 41, Fizz, 43, 44, Fizz Buzz, 46, 47, Fizz, 49, Buzz, Fizz, 52, 53, Fizz, Buzz, 56, Fizz, 58, 59, Fizz Buzz, 61, 62, Fizz, 64, Buzz, Fizz, 67, 68, Fizz, Buzz, 71, Fizz, 73, 74, Fizz Buzz, 76, 77, Fizz, 79, Buzz, Fizz, 82, 83, Fizz, Buzz, 86, Fizz, 88, 89, Fizz Buzz, 91, 92, Fizz, 94, Buzz, Fizz, 97, 98, Fizz, Buzz
@gomasy
gomasy / fizzbuzz3.rb
Last active December 31, 2015 00:09
つい出来心で…
p `curl https://gist.github.com/gomashio/7905686/raw/1a21fdeb3de3220c3a42d054ce957ffc8d9d43c9/fizzbuzz.txt`
@gomasy
gomasy / prime_100000.txt
Created December 24, 2013 14:49
100000までの素数
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 124
@gomasy
gomasy / keys.yml.example
Last active August 29, 2015 13:55
Rubyでupdate_nameするやつ
consumer_key: ""
consumer_secret: ""
oauth_token: ""
oauth_token_secret: ""
/usr/lib/ruby/2.1.0/net/http.rb:879: [BUG] rb_sys_fail(getaddrinfo) - errno == 0
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0011 p:---- s:0058 e:000057 CFUNC :initialize
c:0010 p:---- s:0056 e:000055 CFUNC :open
c:0009 p:0023 s:0049 e:000048 BLOCK /usr/lib/ruby/2.1.0/net/http.rb:879
c:0008 p:0026 s:0047 e:000046 METHOD /usr/lib/ruby/2.1.0/timeout.rb:67
c:0007 p:0082 s:0037 e:000036 METHOD /usr/lib/ruby/2.1.0/net/http.rb:878
c:0006 p:0007 s:0026 e:000025 METHOD /usr/lib/ruby/2.1.0/net/http.rb:863
@gomasy
gomasy / mikutter_sl.rb
Last active August 29, 2015 13:56
作業妨害系プラグイン
# coding: utf-8
Plugin.create(:mikutter_sl) do
# ※Terminatorを使用してる場合
# その他のターミナルソフトを使用している場合は適宜書き換えてください
@cmd_line = "terminator -x sl"
on_mention do |s, msg|
msg.each do |m|
if m.message.to_s =~ /^.*#{Service.primary.user}\s+sl.*$/
@gomasy
gomasy / gist:9205101
Created February 25, 2014 08:33
Twitterアカウントの生存確認bot、cronで走らせてください
#!/usr/bin/ruby
# coding: utf-8
require "net/https"
require "twitter"
target = "" # Target screen name
rest_client = Twitter::REST::Client.new do |config|
config.consumer_key = "" # Your consumer key
eval(%w( [129902
2,676, 10,3039
314725 2,1152
671,17 347988
30,94 215099
71181 3100,1
66883 427851
0,151 7381,1
0,263 30644,
887,289623
@gomasy
gomasy / gist:9490672
Created March 11, 2014 17:26
Sushi is very delicious!
def 🍣
puts "😄😄😄"
end
🍣
#=> 😄😄😄