Skip to content

Instantly share code, notes, and snippets.

View Feed2Typetalk.js
'use strict';
const lastUpdateFileName = './lastupdate.txt';
const feedUrl = '';
const typetalkTopicNum = '__TYPETALK_TOPIC_NUMBER_HERE__';
const typetalkToken = '__TYPETALK_TOKEN_HERE__'
const fs = require('fs');
const FeedParser = require('feedparser');
const https = require('https');
View AllowWPAdminRequestFromLoggedInUser.json
"Name": "AdminRequestFromLoggedInUser",
"Priority": 8,
"Action": {
"Allow": {}
"VisibilityConfig": {
"SampledRequestsEnabled": true,
"CloudWatchMetricsEnabled": true,
"MetricName": "AdminRequestFromLoggedInUser"
View Brewfile
cask_args appdir: "/Applications"
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-versions"
tap "homebrew/cask-fonts"
tap "homebrew/core"
tap "argon/mas"
tap "rcmdnk/file"
wokamoto / remote-site-parts.php
Last active Sep 7, 2018
[WordPress][Plugin] 外部サイトをクロールして、特定の要素を XPath で切り出して表示するウィジェット
View remote-site-parts.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:',
wokamoto /
Created Aug 22, 2018
WordPress の cron event を wp-cli で実行するやつ
wp="/usr/local/bin/wp --path=${wp_root}"
if [ ! -e ${wp_root} ]; then
echo "Not exists ${wp_root}"
exit 1
lock_file="/var/tmp/doing_wp-cron.$(basename $wp_root)"
wokamoto /
Created Aug 16, 2018
amimoto での CodeDeply サンプル
service nginx reload
service monit start
if [ -d /var/cache/myapp ]; then
rm -rf /var/cache/myapp
wokamoto /
Created May 1, 2018
[AWS][CloudFront] 既存の CloudFront をまとめて IPv6 Enabled に変更する ref:
DIST_IDS=$(aws cloudfront list-distributions | jq -r '.DistributionList.Items[] | select(.IsIPV6Enabled == false) | .Id')
for DIST_ID in ${DIST_IDS}; do
ETAG=$(aws cloudfront get-distribution --id ${DIST_ID} | jq -r '.ETag')
jq -s '.[0] * .[1]' <(aws cloudfront get-distribution --id "${DIST_ID}" | jq '.Distribution.DistributionConfig') <(echo '{"IsIPV6Enabled": true}') > ${CONFIG_JSON}
aws cloudfront update-distribution --id ${DIST_ID} --distribution-config file://${CONFIG_JSON} --if-match ${ETAG}
rm -f ${CONFIG_JSON}
wokamoto / file0.txt
Created Mar 2, 2018
[AWS] CloudFront が使用する IP レンジを調べる ref:
View file0.txt
curl -s | jq -r '.prefixes[] | select(.service=="CLOUDFRONT")
wokamoto / file0.txt
Last active Apr 8, 2019
[WordPress] 負荷がかかっている処理を見つけるのに wp profile がとても便利だった ref:
View file0.txt
$ wp package install
Installing package wp-cli/profile-command (dev-master)
Updating /home/ec2-user/.wp-cli/packages/composer.json to require the package...
Registering 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
wokamoto / file0.txt
Last active Feb 23, 2018
[WordPress][Nginx] Nginx 1.13.9 に実装された http2_push_preload を使って HTTP/2 push してみる ref:
View file0.txt
$ sudo /opt/local/provision
$ nginx -v
nginx version: nginx/1.13.9