Skip to content

Instantly share code, notes, and snippets.

View naoaki011's full-sized avatar

naoaki onozaki naoaki011

  • Alfasado Inc.
  • Souka Saitama,Japan
View GitHub Profile
@naoaki011
naoaki011 / lsyncd.conf
Last active April 16, 2021 04:16
lsyncd 複数バケット S3転送パターン
-- lsyncd をインストール
-- sudo yum install -y --enablerepo=epel lsyncd
--
-- バケット名を記載した下記ファイルを用意する
-- /powercms/app/tools/lsyncd_s3buckets.lua
-- 内容
-- lsyncd_target_buckets = {
-- "public-singleaz-01-5h19ik0zpa42ulxr", -- vhost01
-- "", -- vhost02
-- }
@naoaki011
naoaki011 / lsyncd.conf
Last active April 14, 2021 01:58
lsyncd for s3 cli
s3bucket = "public-singleaz-01-5h19ik0zpa42ulxr"
watchpath = "/powercms/data/sites/01/files"
cpexec = function(event)
local src_path = event.sourcePathname
local dst_path = event.sourcePathname
dst_path = string.sub( dst_path , 31 );
spawnShell( event, "aws s3 cp " .. src_path .. " s3://" .. s3bucket .. dst_path .. " --include '*' --exclude '.*' || :" )
end
@naoaki011
naoaki011 / makesyncuser.txt
Last active April 2, 2021 05:34
lsyncd で使う同期用ユーザの作成
#転送元でユーザを作成し、鍵を固める
groupadd syncuser
useradd -g syncuser syncuser
passwd -d syncuser
vi /etc/sudoers.d/suncuser
syncuser ALL=(ALL) NOPASSWD:ALL
su syncuser
cd
mkdir .ssh
@naoaki011
naoaki011 / lsyncd.conf
Last active April 4, 2021 06:39
lsyncd rsync (rsyncssh ではファイルのmvが反映されない模様)
settings {
logfile = "/var/log/lsyncd.log",
statusFile = "/var/log/lsyncd.status",
statusInterval = 1
}
-- /var/www/html
sync {
default.rsync,
source = "/var/www/html/",
target = "syncuser@10.0.0.4:/var/www/html/",
@naoaki011
naoaki011 / gist:9d0985b87f8143c308afa52cdb74ad55
Created October 17, 2018 05:33
SQLでファイルパスに含まれる「\」を「/」に変更する
#アイテムテーブル
UPDATE `mt_asset` SET `asset_file_path` = REPLACE(`asset_file_path`, '\\', '\/') WHERE `asset_file_path` REGEXP '\\\\' ;
#FileInfoテーブル
UPDATE `mt_fileinfo` SET `fileinfo_file_path` = REPLACE(`fileinfo_file_path`, 'D:\\inetpub\\wwwroot', '\/powercms\/data\/sites\/01\/files') WHERE `fileinfo_file_path` REGEXP '\\\\';
UPDATE `mt_fileinfo` SET `fileinfo_file_path` = REPLACE(`fileinfo_file_path`, '\\', '\/') WHERE `fileinfo_file_path` REGEXP '\\\\';
@naoaki011
naoaki011 / gist:d32003d6515e8a28da6c1707b6e28269
Created October 24, 2016 08:53
Salesforce レポートの項目をカスタマイズ表示
作成日時を出したいオブジェクト(今回の場合はセミナー参加オブジェクト)にカスタム項目を一つ追加します。
カスタム項目のデータ型を「数式」にします
数式の戻り値のデータ型を「日付/時間」にします
数式の内容に「CreatedDate」と記述します(作成日時を得る場合)
追加したカスタム項目はそのままではレポートで使用できません。使用したいレポートタイプに[設定] -> [レポートタイプ] (クィック検索に「レポートタイプ」と指定)からアクセスして(今回の場合は「会員_セミナー参加」)、「レポートで選択可能な項目」の編集画面に遷移して、追加したカスタム項目を画面右の項目からドラッグ&ドロップで対象のオブジェクト(今回の場合はセミナー参加オブジェクト)に追加します。
レポートで作成したカスタム項目を配置します。
@naoaki011
naoaki011 / gist:5515857c7c223bfed8b3189b18b1d4fd
Created October 12, 2016 01:26
よくやるディレクトリ下の権限設定(ディレクトリ775 ファイル664)
chmod -R a=rX,u+w,g+w
@naoaki011
naoaki011 / gist:45fd3cfc1432932ad253
Created November 18, 2015 11:58
radio の readonly処理
<!DOCTYPE html><meta charset=UTF-8><title>input type=radio readonly without disabled</title>
<link rel=stylesheet href=https://cdn.jsdelivr.net/pure/0.6.0/pure-min.css>
<style>body { margin: 8px; font-size: large }</style>
<script src=https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js></script>
<script>
jQuery(function($) {
$('input[type="radio"][data-readonly]')
.on("click", function() { $(this).prop("checked", false) });
});
</script>
<div id="contents_main_inner">
<div>
<select id="hoge">
<option value="1">オプション1</option>
<option value="2">オプション2</option>
<option value="3">オプション3</option>
<option value="4">オプション4</option>
<option value="5">オプション5</option>
<option value="6">オプション6</option>
<option value="7">オプション7</option>
@naoaki011
naoaki011 / gist:4563711
Created January 18, 2013 10:32
テンプレート追加するSQL文。
INSERT INTO `mt_template` (`template_blog_id`, `template_build_dynamic`, `template_build_interval`, `template_build_type`, `template_created_by`, `template_identifier`, `template_linked_file`, `template_linked_file_mtime`, `template_linked_file_size`, `template_modified_by`, `template_name`, `template_outfile`, `template_rebuild_me`, `template_text`, `template_type`, `template_current_revision`) VALUES
(36, 0, 0, 2, 1,'', '', NULL, NULL, 1,'NEWTEST', 'test.php', 0, '<h1>TEST</h1>\n<MTArchiveList archive_type="Monthly">\n\n<MTArchiveDate format="blogtimes-%Y%m" setvar="name">\n<MTArchiveDate format="%Y%m" setvar="month">\n<MTBlogTimes name="$name" month="$month" width=400 height=30 save_dir="blogtimes" linecolor="#767F58" textcolor="#767F58" fillcolor="#D4D884" bordercolor="#C0C0C0" padding="5" show_text="on">\n<img src="<$MTBlogTimesFileURL$>" width="<$MTBlogTimesWidth$>" height="<$MTBlogTimesHeight$>" alt="B L O G T I M E S" />\n</MTBlogTimes>\n\n</MTArchiveList>', 'index', 1);