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
location ~* ^/(get_s3)/(.*) { | |
set $s3_bucket 'your_s3_bucket_name.s3.amazonaws.com'; | |
set $url_full "/$1/$2"; | |
proxy_http_version 1.1; | |
proxy_set_header Host $s3_bucket; | |
proxy_set_header Authorization ''; | |
proxy_hide_header x-amz-id-2; | |
proxy_hide_header x-amz-request-id; | |
proxy_hide_header Set-Cookie; |
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 | |
/* | |
Plugin Name: CloudFront Preview Fix | |
Plugin URI: | |
Description: WPログイン時にパーマリンクに記事変更日付を含み、プレビューが最新になるようにする | |
Version: 0.5 | |
Author: | |
Author URI: | |
*/ | |
add_action( 'init', function(){ |
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
esource "aws_iam_role" "run_inspector_role" { | |
name = "cloudwatch-events-run-inspector-role" | |
assume_role_policy = <<POLICY | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { | |
"Service": "events.amazonaws.com" |
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 | |
/***** | |
* https://dev.smt.docomo.ne.jp/?p=docs.api.page&api_docs_id=5 | |
*****/ | |
function webnist($text) { | |
$context_file = dirname(__FILE__).'/.docomoapi.context'; | |
$api_key = 'your API key here'; | |
$api_url = sprintf('https://api.apigw.smt.docomo.ne.jp/dialogue/v1/dialogue?APIKEY=%s', $api_key); | |
$req_body = array('utt' => $text); | |
if ( file_exists($context_file) ) { |
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
$ wp package install git@github.com:wp-cli/profile-command.git | |
Installing package wp-cli/profile-command (dev-master) | |
Updating /home/ec2-user/.wp-cli/packages/composer.json to require the package... | |
Registering git@github.com:wp-cli/profile-command.git as a VCS repository... | |
Using Composer to install the package... | |
--- | |
Loading composer repositories with package information | |
Updating dependencies | |
Resolving dependencies through SAT | |
Dependency resolution completed in 0.212 seconds |
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 | |
require_once("aws.phar"); | |
use Aws\Common\Aws; | |
use Aws\Common\Enum\Region; | |
use Aws\S3\Enum\CannedAcl; | |
use Aws\S3\Exception\S3Exception; | |
$s3 = Aws::factory(array( | |
'key' => $access_key, |
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 | |
/** | |
* Adds Remote_Site_Parts widget. | |
*/ | |
add_action( 'widgets_init', function(){ | |
register_widget( 'Remote_Site_Parts' ); | |
}); | |
class Remote_Site_Parts extends WP_Widget { | |
private $options = [ | |
'title' => 'Title:', |
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 | |
function custom_search($search, $wp_query) { | |
global $wpdb; | |
//サーチページ以外だったら終了 | |
if (!$wp_query->is_search) | |
return $search; | |
if (!isset($wp_query->query_vars)) | |
return $search; |
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 | |
wp_root=${1:-/var/www/html} | |
wp="/usr/local/bin/wp --path=${wp_root}" | |
if [ ! -e ${wp_root} ]; then | |
echo "Not exists ${wp_root}" | |
exit 1 | |
fi | |
lock_file="/var/tmp/doing_wp-cron.$(basename $wp_root)" |
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 | |
service nginx reload | |
service monit start | |
if [ -d /var/cache/myapp ]; then | |
rm -rf /var/cache/myapp | |
fi |