Skip to content

Instantly share code, notes, and snippets.

View oppara's full-sized avatar
:octocat:
::

oppara oppara

:octocat:
::
View GitHub Profile
@oppara
oppara / wordpress_sync.md
Last active October 21, 2022 09:19
WordPress の同期
@oppara
oppara / visual_editor_settings.php
Created December 11, 2019 05:22
WordPress ビジュアルエディタ対応
<?php
// テーマの function.php あたりに追加
// もしくは、プラグインのコンスタラクタあたりに追加
// 管理側固定ページエディター自動挿入のPタグBRタグ削除
// オートフォーマット関連の無効化
add_action('init', function() {
remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');
});
@oppara
oppara / install_rbenv.md
Last active November 15, 2019 02:04
install rbenv global
# git clone https://github.com/rbenv/rbenv.git /usr/local/rbenv
# git clone https://github.com/rbenv/ruby-build.git /usr/local/rbenv/plugins/ruby-build

# vi /etc/profile.d/rbenv.sh
export RBENV_ROOT=/usr/local/rbenv
export PATH=${RBENV_ROOT}/bin:$PATH
eval "$(rbenv init --no-rehash -)"

# source /etc/profile.d/rbenv.sh
@oppara
oppara / multi.php
Last active September 28, 2019 14:22
PHPで標準入力から値を取得
<?php
$inputs = [];
while (true) {
$in = trim(fgets(STDIN));
if ($in === '') {
main($inputs);
return;
}
$inputs[] = $in;
}
@oppara
oppara / multi.php
Last active September 28, 2019 13:37
PHPで標準入力から値を取得
<?php
$inputs = [];
while (true) {
$in = trim(fgets(STDIN));
if ($in === '') {
var_dump($inputs);
return;
}
$inputs[] = $in;
}
@oppara
oppara / multi.php
Created September 28, 2019 13:37
PHPで標準入力から値を取得
<?php
$inputs = [];
while (true) {
$in = trim(fgets(STDIN));
if ($in === '') {
var_dump($inputs);
return;
}
$inputs[] = $in;
}
@oppara
oppara / make_csv.php
Created September 19, 2019 12:16
CSVデータ作成
function makeCsv(array $record)
{
$tmp = [];
foreach ($record as $val) {
if (preg_match('/[,\r\n"]/', $val)) {
$val = str_replace('"', '""', $val);
$tmp[] = '"' . $val . '"';
continue;
}
@oppara
oppara / aws-iam-user-key-rotation.sh
Created September 18, 2019 03:54 — forked from TAKEDA-Takashi/aws-iam-user-key-rotation.sh
指定したAWSプロファイルのアクセスキー をローテーションするスクリプト。
#!/bin/bash -euo pipefail
#
# Usage:
# $ aws-iam-user-key-rotation.sh [profile] [credential_file]
#
declare -x AWS_DEFAULT_PROFILE=${1:-default}
declare credential_file=${2:-~/.aws/credentials}
declare -x AWS_SHARED_CREDENTIALS_FILE=$credential_file
@oppara
oppara / mb_trim.php
Created September 13, 2019 06:22
全角スペースを含む trim
<?php
function trim(string $str): string
{
return preg_replace('/\A[\p{C}\p{Z}]++|[\p{C}\p{Z}]++\z/u', '', $str);
}
# https://github.com/osquery/osquery/blob/master/Vagrantfile
targets = {
"win10" => {
"box" => "inclusivedesign/windows10-eval"
},
"macos10.12" => {
"box" => "jhcook/macos-sierra"
},
"macos10.13" => {