Skip to content

Instantly share code, notes, and snippets.

View nishiyamaosamu's full-sized avatar

Osamu Nishiyama nishiyamaosamu

View GitHub Profile
@nishiyamaosamu
nishiyamaosamu / file0.swift
Last active August 29, 2015 14:18
Xcodeで色付きログのライブラリ(ColorLogger.swift)を作った ref: http://qiita.com/osamu1203/items/86d2a543f70bf094ae0f
let log = ColorLogger.defaultInstance
@nishiyamaosamu
nishiyamaosamu / fail2ban
Last active August 29, 2015 14:17
EC2でnginxの過剰な404|403に対しfail2banをかける ref: http://qiita.com/osamu1203/items/e7b1718caf4fa59dca4f
/var/log/fail2ban/fail2ban.log {
missingok
notifempty
weekly
rotate 5
compress
dateext
create 0644 root root
postrotate
/usr/bin/fail2ban-client set logtarget /var/log/fail2ban/fail2ban.log 2> /dev/null || true
@nishiyamaosamu
nishiyamaosamu / functions.php
Created March 11, 2015 07:02
Enable to Nginx proxy cache for wordpress 404.
function remove_nocache_on_404(){
if(is_404()){
header_remove("Pragma");
header_remove("Cache-Control");
header_remove("Expires");
}
}
add_action('wp','remove_nocache_on_404');
@nishiyamaosamu
nishiyamaosamu / file0.swift
Last active August 29, 2015 14:14
[Swift]たった40行のUIScrollViewを使ったシンプルなチュートリアル画面サンプル ref: http://qiita.com/osamu1203/items/a1a361f9ff00e93258e2
import UIKit
class ViewController: UIViewController, UIScrollViewDelegate {
var scrollView: UIScrollView!
var pageControll: UIPageControl!
let pageNum = 4
let pageColors:[Int:UIColor] = [1:UIColor.redColor(),2:UIColor.yellowColor(),3:UIColor.blueColor(),4:UIColor.greenColor()]
override func viewDidLoad() {
@nishiyamaosamu
nishiyamaosamu / file0.swift
Last active August 29, 2015 14:10
SwiftでiPhoneとiPadを判別する ref: http://qiita.com/osamu1203/items/f45909bdffcf6373f4b6
enum UIUserInterfaceIdiom : Int {
case Unspecified
case Phone // iPhone and iPod
case Pad // iPad
}
@nishiyamaosamu
nishiyamaosamu / file0.txt
Last active December 29, 2015 19:38
vagrantでmountエラーの解決方法 ref: http://qiita.com/osamu1203/items/10e19c74c912d303ca0b
Failed to mount folders in Linux guest. This is usually beacuse
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group apache | cut -d: -f3`,dmode=777,fmode=777 /vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g apache`,dmode=777,fmode=777 /vagrant /vagrant