Skip to content

Instantly share code, notes, and snippets.

@koseki
koseki / HTPasswd.php
Last active August 20, 2017 05:55
PHP - MD5 based htpasswd entry generator class
<?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 June 19, 2017 02:23
Timezone / Daylight Saving Time aware JavaScript class
/**
* 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 July 17, 2016 11:01
Plot sat 5000 words frequency rank
#! /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 June 16, 2023 06:55
WordNet 3.0 + Ruby (rwordnet)
source 'https://rubygems.org'
gem 'rwordnet'
@koseki
koseki / ISO639-1.txt
Last active February 1, 2022 21:41
ISO 639-1 Code => English Name text list / http://www.loc.gov/standards/iso639-2/ascii_8bits.html
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 January 27, 2017 04:09
Git GC の各種設定について

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.

http://www.google.com http://www.github.com
@koseki
koseki / README.md
Last active April 29, 2023 09:13
Nginx: proxy_ignore_headers Set-Cookie is dangerous (vagrant-layout example)

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 August 29, 2015 14:15
Nginx: proxy_ignore_headers Set-Cookie is dangerous (fig example)
php:
image: "php:5.6.5-fpm"
volumes:
- .:/usr/share/nginx/html
web:
image: "nginx:1.7.9"
ports:
- "8080:8080"
links:
- php
@koseki
koseki / fig.yml
Created February 9, 2015 19:47
fig Nginx + php-fpm
php:
image: "php:5.6.5-fpm"
volumes:
- .:/usr/share/nginx/html
web:
image: "nginx:1.7.9"
ports:
- "80:80"
links:
- php