Skip to content

Instantly share code, notes, and snippets.

View komagata's full-sized avatar

Masaki Komagata komagata

View GitHub Profile
require 'benchmark'
num = 10000
Benchmark.bm 2 do |r|
r.report '+' do
str = ''
num.times do
str += 'a'
end
require 'benchmark'
num = 1000000
Benchmark.bm 2 do |r|
r.report '+' do
str = ''
num.times do
str = 'a' + 'b'
end
@komagata
komagata / php.ini
Created June 2, 2015 08:33
php.ini for Yosemite.
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
@komagata
komagata / set_docroot_hack.php
Created June 2, 2015 07:21
docroot hack for VirtualDocumentRoot
<?php
$_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['SCRIPT_FILENAME']);
@komagata
komagata / httpd-vhosts.conf
Created June 2, 2015 07:19
httpd-vhosts.conf for php5 in Yosemite.
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
@komagata
komagata / httpd.conf
Created June 2, 2015 07:15
httpd.conf for php5 in Yosemite.
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@komagata
komagata / packages.config
Last active August 29, 2015 14:19
Packages for chocolatey.
<?xml version="1.0"?>
<packages>
<package id="googlechrome" />
<package id="firefox" />
<package id="curl" />
<package id="git" />
<package id="dropbox" />
<package id="flashplayerplugin" />
<package id="itunes" />
<package id="googledrive" />
@komagata
komagata / csv2yml.py
Last active July 7, 2017 00:58
CSV convert to YAML.
#!/usr/bin/env python
import sys
import csv
if (len(sys.argv) < 2):
print 'Usage: %s ' % sys.argv[0]
quit()
csv_file = sys.argv[1]
@komagata
komagata / window720p
Last active August 29, 2015 14:13
Window set to 1280x720px.
#!/bin/sh
echo "Setting $1 bounds to 720p"
# 720p is 1280x720.
# Bounds is startX, startY, endX, endY. Adjust size from starting position to account for this
osascript -e "tell application \"$1\" to set the bounds of the first window to {0, 0, 1280, 720}"
# activate the app, to bring it to the front
osascript -e "tell application \"$1\" to activate"
@komagata
komagata / gist:0fbcf9c6f84ffae06ce2
Last active August 29, 2015 14:06
アイネクとは

アイネク

これは何?

アマチュアオーケストラでは他団体の演奏会のパンフレットに自団体の演奏会のチラシを無料で挟み込ませてもらうことが一般的に行われている。 アイネクは地域のアマチュアオーケストラの検索、チラシを挟み込みたい団体とのマッチングを行うサイトである。

解決したい問題

  • 自分の地域にどんなアマチュアオーケストラがあるのかわからない