Skip to content

Instantly share code, notes, and snippets.

View mizoR's full-sized avatar

Ryutaro Mizokami mizoR

  • Fukuoka, Japan
View GitHub Profile
@mizoR
mizoR / webgl-constants-by-name
Created November 29, 2019 11:46 — forked from szimek/webgl-constants-by-name
WebGL context constants
ACTIVE_ATTRIBUTES: 35721
ACTIVE_ATTRIBUTE_MAX_LENGTH: 35722
ACTIVE_TEXTURE: 34016
ACTIVE_UNIFORMS: 35718
ACTIVE_UNIFORM_MAX_LENGTH: 35719
ALIASED_LINE_WIDTH_RANGE: 33902
ALIASED_POINT_SIZE_RANGE: 33901
ALPHA: 6406
ALPHA_BITS: 3413
ALWAYS: 519
@mizoR
mizoR / gist:ee4d81ccefb3547fd432b6dcb80d86d9
Created October 31, 2019 22:12
UNIXという考え方 The UNIX philosophy

UNIXという考え方 The UNIX philosophy

定理

1. Small is beautiful. 小さいものは美しい

小さいものは、大きい物にない利点がいくつもある。小さいもの同士なら簡単に独特の便利な方法で組み合わせることができる
@mizoR
mizoR / unicorn-running-counter.sh
Last active September 23, 2015 02:47
TASK_RUNNING な unicorn-worker の プロセス数を数えるワンライナー
while; do; echo -n $(date); echo -n ' '; ps l --ppid=$(ps alx | grep unicorn | grep master | awk "{ print \$3 }") | awk "{ print \$10}" | grep R | wc -l; sleep 3; done rbenv:syst
@mizoR
mizoR / gist:351c36eeb1282570d199
Created January 10, 2015 06:30
Ruby で 月ごとに繰り返す
require 'date'
# 実際は ActiveSupport の機能をつかう
class Date
def beginning_of_month
self.class.new(self.year, self.month, 1)
end
end
class MonthlyEnumerator < Enumerator
@mizoR
mizoR / gist:e62388f260285fd4f5b5
Created June 25, 2014 05:40
inode が 枯渇したとき

i-node を使用しているディレクトリを探す

$ find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n

2日前のXMLファイルを削除する

$ find ./ -mtime +2 -name "*.xml" | xargs rm -f
#!/usr/bin/env ruby
require 'open3'
require 'optparse'
module RunAndNotify
def self.parse!(argv)
notifiers = []
opt = OptionParser.new
opt.on('--notifier NOTIFIER') {|v|
@mizoR
mizoR / email_doc.rb
Created May 24, 2014 04:37
Rails で ActionMailer の メールの内容を マークダウンで出力するためのモジュール
require 'spec_helper'
require 'forwardable'
module EmailDoc
def self.doc_path
Rails.root.join('doc', 'mail')
end
def self.documents
@documents ||= Documents.new
sed -e 's/https:\/\/gist.github.com\/\([0-9a-z][0-9a-z]*\).git/git@github.com:\1.git/'
#!/bin/bash
set -e
command_name=`basename $0`
function usage() {
echo "Usage:"
echo " $command_name --username username --org org [OPTIONS]"
echo
@mizoR
mizoR / git-stock
Last active December 25, 2015 22:49
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
require 'open-uri'
require 'json'
class String
def blue
"\e[34m" + self + "\e[m"
end