Skip to content

Instantly share code, notes, and snippets.

View oieioi's full-sized avatar
🐙
🐙🐙🐙🐙🐙🐙🐙🐙🐙

oieioi

🐙
🐙🐙🐙🐙🐙🐙🐙🐙🐙
View GitHub Profile
#! /bin/sh
exec ruby -S -x "$0" "$@"
#! ruby
# 迷路のマス
class Cell
def initialize(value)
@value = value
# どのマスからくるか
@prev_value = case value
@oieioi
oieioi / 1621.rb
Last active August 29, 2015 14:24
get primes
raw_list = []
while str = STDIN.gets.chomp
break if str.empty?
raw_list.push str.to_i
end
class GetterPrimer
def initialize
@primes = [2]
@max_checked = 2
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FALSE 0
#define TRUE 1
int isPrime(int num) {
if (num == 0) {
def get_patterns(number, operators)
numbers = number.split ''
size = numbers.size
p operators
.repeated_permutation(size - 1)
.map { |operators_combination|
numbers.map.with_index {|num, index| "#{num}#{operators_combination[index]}"}
}
.map { |item| eval item.join('').gsub(/^0/, '')}
@oieioi
oieioi / 1643.rb
Last active August 29, 2015 14:25
get power
def cut8column(num)
if num.to_s.size > 8
num.to_s.slice(-8, 8).to_i
else
num
end
end
def get_pow(b, exponent)
if b == 0
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>mithriltest</title>
<script src="//cdnjs.cloudflare.com/ajax/libs/mithril/0.2.0/mithril.min.js"></script>
<script>
// Namespace
var todo = {};
@oieioi
oieioi / favorites_trace.rb
Last active November 18, 2017 10:33 — forked from no6v/trace.rb
Trace back home or user timeline
# encoding: UTF-8
Earthquake.once do
module TwitterOAuth
class Client
def favorites_list(user, **options)
options = URI.encode_www_form(options)
get("/favorites/list.json?screen_name=#{user}&#{options}")
end
end
end
@oieioi
oieioi / oreilly.coffee
Last active October 22, 2015 10:14
hubot script which gets a random O'Reilly book
# Description:
# Let's study with O'Reilly books
#
# Dependencies:
# "cheerio-httpcli": "^0.3.3"
#
# Commands:
# hubot 勉強したい - get a オライリー book
cheerio = require 'cheerio-httpcli'
@oieioi
oieioi / search_commit_msg
Last active October 7, 2016 09:25 — forked from necojackarc/search_commit_msg
Getting commit massage samples script powered by http://commit-m.minamijoyo.com/
#!/usr/bin/env ruby
require "net/http"
require "uri"
require "nokogiri"
params = { keyword: ARGV.join("\s") }
uri = URI.parse("http://commit-m.minamijoyo.com/commits/search")
uri.query = URI.encode_www_form(params)
@oieioi
oieioi / phantom.rb
Last active June 23, 2016 07:04
Ultima Online phantom
oo = %w(O o)
time = ARGV[0].to_i
puts time.times.map{oo.sample 1}.flatten.join