Skip to content

Instantly share code, notes, and snippets.

View PharaohKJ's full-sized avatar
👺
Ten-goods come on! Working from home

ふぁらお加藤 PharaohKJ

👺
Ten-goods come on! Working from home
View GitHub Profile
@PharaohKJ
PharaohKJ / boolean_spec.rb
Created January 25, 2016 00:41
rspecでboolean値をテストする
RSpec::Matchers.define :be_boolean do
match do |actual|
expect(actual).to satisfy { |x| x == true || x == false }
end
end
it 'is boolean' do
expect(true).to be_boolean
end
def ensure_em
unless EventMachine.reactor_running? && EventMachine.reactor_thread.alive?
Thread.new { EventMachine.run }
sleep 1
end
end
@PharaohKJ
PharaohKJ / .bashrc
Created August 26, 2013 23:23
ubuntu PS1
PS1="\\[\\033[32m\\][\\h: \\w]\\[\\033[0m\\]\\n\\u\\\$ "
@PharaohKJ
PharaohKJ / iptables
Created August 3, 2013 07:04
Asset Server 向け iptables設定
# 外部からTCPポート10733番(Unity Asset Server接続)へのアクセスを許可
-A Firewall-setting1-INPUT -m state --state NEW -m tcp -p tcp --dport 10733 -j ACCEPT
@PharaohKJ
PharaohKJ / .bashrc
Created June 28, 2013 12:27
osx bashrc
# プロンプトの設定
PS1='\[\033[0;32m\w\[\033[0m\n[\u]\$ '
@PharaohKJ
PharaohKJ / randompass.sh
Created June 22, 2013 08:34
A-Za-z0-9_でのパスワード生成シェル 数字は文字数
tr -dc A-Za-z0-9_ < /dev/urandom | head -c 12 | xargs
@PharaohKJ
PharaohKJ / thunderbird_with_log.sh
Created May 22, 2013 10:03
debug smtp log for thunderbird
export NSPR_LOG_FILE=/tmp/smtplog.log
export NSPR_LOG_MODULES=IMAP:5,SMTP:5,POP3:5
thunderbird
gvim /tmp/smtplog.log
@PharaohKJ
PharaohKJ / Makefile
Last active December 17, 2015 04:59
間違えて非公開にしちゃったので公開で。redmineをupdateしたあとに入力するコマンド忘れるのでMakefileにしておきます。
## Redmineをアップデートしたら叩くmake
## make update
## としてくれ
# DBのアップデート
migration:
rake db:migrate RAILS_ENV="production"
# キャッシュの削除
clean_cache:
@PharaohKJ
PharaohKJ / history_of_install_jenkins_on_my_ubuntu
Created May 8, 2013 06:48
apt-get jenkinsしたあとに、バージョンが古いので本家からインストールしようとしたら結構ハマった。 たぶん最初のsudo apt-get remove jenkinsを **sudo apt-get --purge autoremove jenkins** にしてればさっくりいったんだと思われる。
2009 sudo apt-get remove jenkins
2010 cd tmp/
2011 wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
2012 sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
2013 sudo apt-get update
2014 sudo apt-get install jenkins
2015 whoami
2016 ls /usr/share/jenkins/jenkins.war
2017 ls /usr/share/jenkins/jenkins.war -al
2018 ls /usr/share/jenkins/
@PharaohKJ
PharaohKJ / iptables
Created May 7, 2013 15:48
http://www.imosan-works.com/archives/1074 よりパクらせてもらった設定のメモ。sshのポートは隠すよ。
*filter
# INPUTチェイン宣言(全ての入力パケットを許可する)
:INPUT ACCEPT [0:0]
# FORWARDチェイン宣言(全ての転送パケットを許可する)
:FORWARD ACCEPT [0:0]
# OUTPUTチェイン宣言(全ての出力パケットを許可する)
:OUTPUT ACCEPT [0:0]
#Firewallのセッティング
:Firewall-setting1-INPUT - [0:0]