Skip to content

Instantly share code, notes, and snippets.

View gomasy's full-sized avatar

Gomasy gomasy

View GitHub Profile
require "socket"
def inquiry(host, domain)
whois = ""
socket = TCPSocket.open(host, 43)
socket.puts domain
while socket.gets != nil do
str = socket.gets
whois << str if str != nil
end
@gomasy
gomasy / Xorg.0.log
Created April 28, 2014 07:45
Xorg doesn't start on QEMU
[ 10.140]
X.Org X Server 1.15.1
Release Date: 2014-04-13
[ 10.141] X Protocol Version 11, Revision 0
[ 10.141] Build Operating System: Linux 3.14.0-4-ARCH x86_64
[ 10.142] Current Operating System: Linux archvpc.localdomain 3.14.1-1-ARCH #1 SMP PREEMPT Mon Apr 14 20:40:47 CEST 2014 x86_64
[ 10.142] Kernel command line: BOOT_IMAGE=/vmlinuz-linux root=UUID=50e60c39-9e20-4000-8c19-2bdebf1939cd rw quiet
[ 10.142] Build Date: 14 April 2014 08:39:09AM
[ 10.142]
[ 10.143] Current version of pixman: 0.32.4
class SandBox
def self.exec(code)
result = nil
Timeout::timeout(5) do
result = Thread.new do
$SAFE = 4
instance_eval(code)
end.value
end
return result
@gomasy
gomasy / gist:9826464
Last active August 29, 2015 13:57
/1.1/statuses/show/449426250688638976.json を公式とサードパーティの CK / CS でそれぞれ叩いた結果
** 公式(Twitter for iPhone) **
{
"contributors": null,
"coordinates": null,
"created_at": "Fri Mar 28 06:02:22 +0000 2014",
"entities": {
"hashtags": [],
"media": [
{
@gomasy
gomasy / HappyBirthday.rb
Last active August 29, 2015 13:57
お誕生日おめでとう! in Ruby
"お誕生日おめでとう!!!".chars{|s|print s*3}
#=> おおお誕誕誕生生生日日日おおおめめめでででとととううう!!!!!!!!!
require "socket"
socket = TCPServer.open(4545)
loop do
Thread.new(socket.accept) do |s|
str = ""
loop do
num = rand(6).to_s
s.write(num)
str << num
/usr/lib/ruby/2.1.0/openssl/buffering.rb:326: [BUG] Segmentation fault at 0x007ff09c0000a8
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0021 p:---- s:0099 e:000098 CFUNC :syswrite
c:0020 p:0164 s:0095 e:000094 METHOD /usr/lib/ruby/2.1.0/openssl/buffering.rb:326
c:0019 p:0009 s:0086 e:000085 METHOD /usr/lib/ruby/2.1.0/openssl/buffering.rb:344
c:0018 p:0028 s:0082 e:000081 METHOD /usr/lib/ruby/2.1.0/net/protocol.rb:211
c:0017 p:0009 s:0077 e:000076 BLOCK /usr/lib/ruby/2.1.0/net/protocol.rb:185
c:0016 p:0027 s:0075 e:000074 METHOD /usr/lib/ruby/2.1.0/net/protocol.rb:202
@gomasy
gomasy / gist:9490672
Created March 11, 2014 17:26
Sushi is very delicious!
def 🍣
puts "😄😄😄"
end
🍣
#=> 😄😄😄
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: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