- 社内用のリポジトリ管理のためにGitLabを使用
- pixivはPC・Touch版などがありそれぞれソースコードを一部共有しているためpixiv.gitという1つの大きなリポジトリで管理している
- 社内で一番大きく関わっている人も多いリポジトリ
- pixiv.gitは1.4GBくらい(昔は2GB超だったが工夫して減らした)なので外部サービスのGitHubに置くと遅すぎて開発ができない
- GitHubの障害によりデプロイができなくなるのも困る
- GitHubにはファイルの容量制限など様々な制限もあるのでそういったことで悩みたくない
- 社内のデータセンター内で管理する必要がある
- pixivはPC・Touch版などがありそれぞれソースコードを一部共有しているためpixiv.gitという1つの大きなリポジトリで管理している
- GitHub Enterpriseを使えば社内のサーバー上にGitHubを立てることができる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
for (<>) { | |
if (/\ACREATE TABLE ([`a-zA-Z0-9_]+)/) { | |
print "\nALTER TABLE " . $1 . "\n"; | |
} elsif (/\A[ ]+([`a-zA-Z0-9_]+) (varchar\(\d+\)|mediumtext|text)(( NOT NULL,)?)/) { | |
if ($3) { | |
print " MODIFY " . $1 . " " . $2 . " CHARACTER SET utf8mb4 NOT NULL,\n"; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N = 2**60 | |
r = 1.0 | |
(1..7000000).each do |i| | |
r *= ((N.to_f - i + 1) / N) | |
end | |
p 1 - r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
type weight struct { | |
weight float64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"crypto/md5" | |
"fmt" | |
"os" | |
"time" | |
goCache "github.com/pmylund/go-cache" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
my $sum = 0; | |
while(<>) { | |
if(m/\A# Query_time: ([0-9.]+)/){ | |
$sum = $sum + $1; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ruby-prof' | |
RubyProf.start | |
# code... | |
results = RubyProf.stop | |
# Print a flat profile to text | |
File.open "#{Rails.root}/tmp/performance/#{file_name}-graph.html", 'w' do |file| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PATH=/usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin | |
NAME=unicorn | |
RAILS_ENV=${RAILS_ENV:-production} | |
APP=application_name | |
EX_USER=www-data | |
ROOT_DIR="/home/$USER/$APP/current" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
window.jQuery || document.write('<script src="/js/jquery.min.js"><\/script>'); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
error_reporting(-1); | |
ini_set('display_errors', true); | |
$OK = 0; | |
$WARNING = 1; | |
$CRITICAL = 2; | |
$UNKNOWN = 3; |