Skip to content

Instantly share code, notes, and snippets.

@kyama
kyama / kantei.rss
Last active September 20, 2025 17:01
An updated gist description
<?xml version='1.0' encoding='UTF-8'?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
<channel>
<title>首相官邸</title>
<link>https://www.kantei.go.jp</link>
<description>公式サイトからの新着情報を取得しました。</description>
<atom:link href="https://www.kantei.go.jp" rel="self"/>
<docs>http://www.rssboard.org/rss-specification</docs>
<generator>python-feedgen</generator>
<image>
@kyama
kyama / gist:baa928fbff3d3e92c761
Last active August 29, 2015 14:14
[ruby]日付一覧を表示
# 半月分の日の一覧を表示
# 参考:http://qiita.com/ozamasa/items/20853d5fce6677d0f346
require 'date'
0.upto(14).inject(Date.new(2015,2,2)){|d,i|puts (d+i).strftime("%2m月%2d日(#{%w(日 月 火 水 木 金 土)[(d+i).wday]})");d}
//
// Zero-suppressed binary decision diagram with family algebra operations
//
// References:
// S. Minato (1993):
// Zero-suppressed BDDs for set manipulation in combinatorial problems.
// Proceedings of the 30st annual Design Automation Conference, pp. 272-277.
// S. Minato (1994):
// Calculation of unate cube set algebra using zero-suppressed BDDs.
// Proceedings of the 31st annual Design Automation Conference, pp. 420-424.
@kyama
kyama / gist:5945799
Created July 8, 2013 02:20
■■×■■×■=■×■■×■ となるような■は? ■は全て互いに全て異なる1〜9までの一桁の数だよ。これはきっと簡単。 これ、ふと、思いついて、プログラム作って計算してみた。ストックがあったのでプログラムは5分でできたよ。 https://twitter.com/Poyo_F/status/353791971036364802
ruby -e ' (1..9).to_a.permutation(9).each {|v| if (v[0]*10 + v[1])*(v[2]*10+v[3])*v[4]==v[5]*(v[6]*10+v[7])*v[8];puts v.join(" ");end;}'
#
# k means clustering
#
# https://gist.github.com/kyama/5171166
#
# Date:: 2013.03.15
#
class Kmeans
def initialize seed=1234,size=100,max_value=5000,cluster_size=50
ruby -r 'digest/sha1' -e 'puts Digest::SHA1.hexdigest(File.open("<FILENAME>", "rb").read)'
ruby -e 'puts (0..11).collect {|e| (300.0/11.0*e).truncate%60}.join(",")'