Skip to content

Instantly share code, notes, and snippets.

View dulltz's full-sized avatar
🏠
Working from home

Takahiro Tsuruda dulltz

🏠
Working from home
  • Nikkei
  • Tokyo
  • 18:33 (UTC +09:00)
  • X @dulltz
View GitHub Profile
@dulltz
dulltz / count_active.py
Last active March 8, 2024 09:42
Count unique GitHub users committed to a specified repositories within 90 days, to check the required number of licenses for GitHub Advanced Security or Snyk.
#!/usr/bin/env python3
import json
import os
import sys
from datetime import datetime, timedelta
import requests
TOKEN = os.environ.get('GITHUB_TOKEN')
@dulltz
dulltz / main.go
Created September 14, 2018 02:33
Create RBAC
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
@dulltz
dulltz / gist:79606e5d38ffb7644072d2224e2e0fa2
Last active September 7, 2017 01:15
リーダブルコード4章

まとめ

  • コードのシルエットを整えよう
  • メソッド内の処理を分類してまとめよう
  • 整列できるように共通処理を抜き出そう

なぜ美しさが大切か

パット見でわかるから

@dulltz
dulltz / 1-1.rb
Created January 20, 2016 13:12
世界で戦うプログラミング力を鍛える150問 の解答
# 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
@dulltz
dulltz / booru_clawler.rb
Last active August 29, 2015 14:22
booru clawler
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
@dulltz
dulltz / gist:5931406
Last active December 19, 2015 09:09
2013春C 知識・自然言語処理の課題(1)
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
@dulltz
dulltz / gist:5916076
Created July 3, 2013 07:24
スコアを計算した結果
-------------Group 0-----------------------
ソニックX
成恵の世界
ダーク・エンジェルII
*アンテナ:番組表をキーワード検索*
オールスター感謝祭
関口さんII
カスミン(3)
時空冒険記ゼントリックス
FIRESTORM