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 | |
# Usage: | |
# rsync_pigz $REMOTE:$SRC $DEST | |
# rsync_pigz $SRC $REMOTE:$DEST | |
SRC=$1 | |
DEST=$2 | |
if [[ $SRC == *:* ]] && [[ $DEST == *:* ]]; then | |
echo "Cannot use remote both SRC and DEST" |
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
# frozen_string_literal: true | |
source "https://rubygems.org" | |
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | |
gem 'gollum' |
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
--- | |
version: 0.4 | |
# Global environment variables | |
env: | |
DEPLOY_TO: /tmp/deploy | |
networks: | |
local: | |
hosts: |
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
<?php | |
$c = [ | |
'6.9.3-1' => '10', | |
'6.9.3-10' => '10', | |
'6.9.3-2' => '10', | |
]; | |
uksort($c, function ($a, $b) { | |
$a = preg_split('/[^0-9]/', $a); | |
$b = preg_split('/[^0-9]/', $b); |
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
class Dir | |
class << self | |
alias_method :orig, :[] | |
end | |
def self.[](pattern) | |
binding.pry | |
self.orig(pattern) | |
end | |
end |
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
source "https://rubygems.org" | |
gem 'ffi' |
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 | |
# more safety iptables-rule checker script | |
# Example | |
# iptables -A INPUT -p tcp --dport 22 -j REJECT | |
iptables-save > /tmp/iptables.up.rules.bak | |
( sleep 3; iptables-restore < /tmp/iptables.up.rules.bak; echo "Discard changes") & | |
iptables-restore < /etc/iptables.up.rules |
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
/** | |
* preg_match | |
* | |
* @param array $patterns preg_matchに渡せるpattern文字列の配列 | |
* @param string $subject 調べる文字列 | |
*/ | |
function preg_match_any(array $patterns, $subject) { | |
foreach ($patterns as $pattern) { | |
if (preg_match($pattern, $subject) === 1) return true; | |
} |
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
<configuration> | |
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
<file>${application.home}/logs/application.log</file> | |
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
<!-- Daily rollover without compression --> | |
<fileNamePattern>application-log-%d{yyyy-MM-dd}.log</fileNamePattern> | |
<!-- keep 30 days worth of history --> | |
<maxHistory>30</maxHistory> | |
</rollingPolicy> | |
<encoder> |
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 | |
PROJECT_ROOT="/var/www/current" | |
WARN_LIMIT=64 | |
CRIT_LIMIT=128 | |
export RAILS_ENV=production | |
### rbenvを使う場合、RBENV_ROOTとPATHを適切に設定する必要がある | |
# export RBENV_ROOT="/usr/local/rbenv" | |
# export PATH="${RBENV_ROOT}/bin:${RBENV_ROOT}/shims:${PATH}" |
NewerOlder