Skip to content

Instantly share code, notes, and snippets.

:octocat:

KOSEKI Kengo koseki

:octocat:
Block or report user

Report or block koseki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@koseki
koseki / dst.md
Last active Dec 31, 2018
サマータイム終了時の挙動
View dst.md

タイムゾーン America/Los_Angeles では、サマータイム終了日 2018/11/04 の 01:00:00 〜 01:59:95 が2度繰り返される。

Ruby の Time は、午前1時台をサマータイム終了後として扱っている。

irb(main):001:0> ENV['TZ'] = 'America/Los_Angeles'
=> "America/Los_Angeles"
irb(main):002:0> Time.local(2018, 11, 4, 0, 59, 0)
=> 2018-11-04 00:59:00 -0700
irb(main):003:0> Time.local(2018, 11, 4, 0, 59, 0).dst?
@koseki
koseki / HTPasswd.php
Last active Aug 20, 2017
PHP - MD5 based htpasswd entry generator class
View HTPasswd.php
<?php
/**
* MD5 based htpasswd entry generator
*
* Original: https://stackoverflow.com/questions/2994637/how-to-edit-htpasswd-using-php/8786956#8786956
* Spec: https://httpd.apache.org/docs/2.4/misc/password_encryptions.html
*
*
* random_compat is required if you are using PHP < 7.0.
@koseki
koseki / DateTime.js
Last active Jun 19, 2017
Timezone / Daylight Saving Time aware JavaScript class
View DateTime.js
/**
* var d = new DateTime(2017, 3, 21, 19, 0, 0, 'JST');
* d.setTimezone('PST');
* console.log(d.format());
*/
var DateTime = (function () {
// Constructor
var DateTime = function(year, month, date, hour, min, sec, tz) {
month = month - 1;
@koseki
koseki / sat5000-google20k-plot.rb
Created Jul 17, 2016
Plot sat 5000 words frequency rank
View sat5000-google20k-plot.rb
#! /usr/bin/env ruby
require 'open-uri'
unless File.exist?('sat5000.html')
open('http://www.freevocabulary.com/') do |io|
open('sat5000.html', 'w') do |out|
out.puts(io.read)
end
end
@koseki
koseki / Gemfile
Last active Jul 12, 2016
WordNet 3.0 + Ruby (rwordnet)
View Gemfile
source 'https://rubygems.org'
gem 'rwordnet'
View ISO639-1.txt
aa Afar
ab Abkhazian
af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
an Aragonese
hy Armenian
as Assamese
@koseki
koseki / README.md
Last active Jan 27, 2017
Git GC の各種設定について
View README.md

git gc の各種設定について

git gc 関連の設定のメモ。

git help config で確認できる。見出しの値はデフォルト。

gc.auto 6700

When there are approximately more than this many loose objects in the repository, git gc --auto will pack them.

View test.csv
http://www.google.com http://www.github.com
@koseki
koseki / README.md
Last active Aug 29, 2015
Nginx: proxy_ignore_headers Set-Cookie is dangerous (vagrant-layout example)
View README.md

Nginx proxy_ignore_headers example

This is configuration of vagrant-layout plugin. Based on php layout.

Nginx proxy_ignore_headers Set-Cookie; cache Cookies. The directive has irrelevant name, when using with Set-Cookie header. 💀

Installation

@koseki
koseki / fig.yml
Last active Aug 29, 2015
Nginx: proxy_ignore_headers Set-Cookie is dangerous (fig example)
View fig.yml
php:
image: "php:5.6.5-fpm"
volumes:
- .:/usr/share/nginx/html
web:
image: "nginx:1.7.9"
ports:
- "8080:8080"
links:
- php
You can’t perform that action at this time.