layout: post title: "Qiita APIで自動投稿" date: 2013-01-23 23:41 comments: true published: true qiita: tags: - name: ruby versions:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'csv' | |
class Level | |
attr_reader :key, :parent, :bytesize, :total_bytesize, :children | |
def initialize parent, key, bytesize = 0 | |
@parent = parent | |
@key = key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IMAGE=${IMAGE:-alpine:3.7} | |
TARGET_VOLUME=$1 | |
if [ -z ${TARGET_VOLUME} ]; then | |
echo "Usage $0 <volume name>" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Capturable | |
EXCLUDE_METHODS = [:class, :send, :respond_to?, :capture_methods, :__send__, :__id__] | |
def self.included(base) | |
base.class_eval do | |
def self.capture_methods options={} | |
method_list = options[:method_list] | |
exclude_methods = options[:exclude_methods] || [] | |
exclude_regexp = options[:exclude_regexp] || /\A_/ | |
source_root = case options[:source_root] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task("pre:compile", function(event,logger) { | |
var wrench = require("wrench"), | |
fs = require("fs"), | |
jade = require("jade"), | |
view_root = event.dir.views, | |
path = require("path"), | |
coffee = require("coffee-script"); | |
event.alloyConfig.xml = []; | |
event.alloyConfig.coffee = { home: [], resources: [] }; |
#NoSQLデータモデリング技法
原文:NoSQL Data Modeling Techniques « Highly Scalable Blog
I translated this article for study. contact matope[dot]ono[gmail] if any problem.
NoSQLデータベースはスケーラビリティ、パフォーマンス、一貫性といった様々な非機能要件から比較される。NoSQLのこの側面は実践と理論の両面からよく研究されている。ある種の非機能特性はNoSQLを利用する主な動機であり、NoSQLシステムによく適用されるCAP定理がそうであるように分散システムの基本的原則だからだ。一方で、NoSQLデータモデリングはあまり研究されておらず、リレーショナルデータベースに見られるようなシステマティックな理論に欠けている。本稿で、私はデータモデリングの視点からのNoSQLシステムファミリーの短い比較といくつかの共通するモデリングテクニックの要約を解説したい。
本稿をレビューして文法を清書してくれたDaniel Kirkdorfferに感謝したいと思う
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'uri' | |
require 'net/http' | |
require 'cgi' | |
require 'nokogiri' | |
EM_URL = URI.parse('http://encodemaniax.com') | |
def build_query data, charset='utf-8' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target_pid = ARGV[0].to_i | |
target_yo_user = ARGV[1].upcase | |
threshold_cpu = (ARGV[2] || 50).to_i | |
sampling_times = (ARGV[3] || 3).to_i | |
sleep_sec = (ARGV[4] || 1).to_i | |
puts "watching #{target_pid}..." | |
puts " - Target YO User: #{target_yo_user}" | |
puts " - Threshold of CPU Usage: #{threshold_cpu}%" | |
puts " - Sampling times: #{sampling_times}" | |
puts " - Sleep Seconds: #{sleep_sec}s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yo="curl -X POST -d username=$USERNAME -d api_token=$APITOKEN https://api.justyo.co/yo/" | |
until nslookup rubygems.org && nslookup bb-m.rubygems.org && $yo; do echo "fail..."; sleep 1; done |
NewerOlder