- コードのシルエットを整えよう
- メソッド内の処理を分類してまとめよう
- 整列できるように共通処理を抜き出そう
パット見でわかるから
| #!/usr/bin/env python3 | |
| import json | |
| import os | |
| import sys | |
| from datetime import datetime, timedelta | |
| import requests | |
| TOKEN = os.environ.get('GITHUB_TOKEN') |
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "path/filepath" | |
| "k8s.io/api/rbac/v1" | |
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
| "k8s.io/client-go/kubernetes" |
| package main | |
| import ( | |
| "fmt" | |
| "golang.org/x/tour/tree" | |
| ) | |
| // Walk walks the tree t sending all values | |
| // from the tree to the channel ch. |
| kind: Node | |
| name: my-node | |
| spec: | |
| interfaces: | |
| - my-net | |
| volumes: | |
| - name: ubuntu | |
| source: https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img | |
| recreatePolicy: IfNotPresent | |
| - name: seed |
| # encoding: utf-8 | |
| counter = Hash.new(0) | |
| $stdin.read.split("").each do |w| | |
| counter[w] += 1 | |
| end | |
| if counter.values.max <= 1 | |
| puts "No duplication" | |
| elsif | |
| puts "duplication" |
| #!/usr/bin/env ruby | |
| require 'open-uri' | |
| base_urls = %w(http://mgkkk.cocolog-nifty.com/blog/files/ | |
| http://mgkkk.la.coocan.jp/podcast/ | |
| ) | |
| start_i = ARGV[0].nil? ? 0 : ARGV[0].to_i | |
| end_i = ARGV[1].nil? ? 211 : ARGV[1].to_i | |
| base_i=0 |
| require 'faraday' | |
| require 'json' | |
| require 'open-uri' | |
| require 'fileutils' | |
| def get_posts tags=['genga','yoh_yoshinari'], site_url='http://sakuga.yshi.org', mode=:normal | |
| conn = Faraday::Connection.new(url: site_url) do |builder| | |
| builder.use Faraday::Request::UrlEncoded | |
| builder.use Faraday::Response::Logger | |
| builder.use Faraday::Adapter::NetHttp |
| mecab -F "%f[6] %f[0]\n" sen179k.txt | LC_ALL=C sort | uniq -c | LC_ALL=C sort -nr | grep -v "EOS" | sed 15q > result1-1.txt | |
| mecab -F "%f[6] %f[0]\n" neko.txt | grep "名詞" | LC_ALL=C sort | uniq -c | LC_ALL=C sort -nr | grep -v "EOS" | sed 15q > result1-2.txt | |
| wget http://www.mast.tsukuba.ac.jp/outline/index.html | |
| mecab -F "%f[6] %f[0]\n" index.html | egrep " 動詞|名詞" | LC_ALL=C sort | uniq -c | grep -v "EOS" > result1-3.txt |
| -------------Group 0----------------------- | |
| ソニックX | |
| 成恵の世界 | |
| ダーク・エンジェルII | |
| *アンテナ:番組表をキーワード検索* | |
| オールスター感謝祭 | |
| 関口さんII | |
| カスミン(3) | |
| 時空冒険記ゼントリックス | |
| FIRESTORM |