Skip to content

Instantly share code, notes, and snippets.

View wokamoto's full-sized avatar

wokamoto wokamoto

View GitHub Profile
@wokamoto
wokamoto / pushToSlack.js
Created March 13, 2023 07:57
pushToSlack.js
'use strict';
const https = require('https');
const util = require('util');
const project = process.env.project;
const slachChannel = process.env.slachChannel;
const slackPath = process.env.slackPath;
async function sendRequest(opts,replyData){
@wokamoto
wokamoto / keybaseProof.md
Last active January 13, 2023 00:43
keybaseProof.md

Keybase proof

I hereby claim:

  • I am wokamoto on github.
  • I am wokamoto (https://keybase.io/wokamoto) on keybase.
  • I have a public key ASDGzDKw-516wDu3n1fgijVBijydz-Qn8a4goEHH6Va3Pwo

To claim this, I am signing this object:

'use strict';
const lastUpdateFileName = './lastupdate.txt';
const feedUrl = 'https://example.com/rss';
const typetalkTopicNum = '__TYPETALK_TOPIC_NUMBER_HERE__';
const typetalkToken = '__TYPETALK_TOKEN_HERE__'
const fs = require('fs');
const FeedParser = require('feedparser');
const https = require('https');
{
"Name": "AdminRequestFromLoggedInUser",
"Priority": 8,
"Action": {
"Allow": {}
},
"VisibilityConfig": {
"SampledRequestsEnabled": true,
"CloudWatchMetricsEnabled": true,
"MetricName": "AdminRequestFromLoggedInUser"
@wokamoto
wokamoto / Brewfile
Last active February 27, 2021 12:19
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
wokamoto / remote-site-parts.php
Last active September 7, 2018 01:55
[WordPress][Plugin] 外部サイトをクロールして、特定の要素を XPath で切り出して表示するウィジェット
<?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
wokamoto / doing-wp-cron.sh
Created August 22, 2018 05:34
WordPress の cron event を wp-cli で実行するやつ
#!/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)"
@wokamoto
wokamoto / after_install.sh
Created August 16, 2018 08:52
amimoto での CodeDeply サンプル
#!/bin/bash
service nginx reload
service monit start
if [ -d /var/cache/myapp ]; then
rm -rf /var/cache/myapp
fi
@wokamoto
wokamoto / update-distribution.sh
Created May 1, 2018 08:39
[AWS][CloudFront] 既存の CloudFront をまとめて IPv6 Enabled に変更する ref: https://qiita.com/wokamoto/items/7eef100532fcced8d6d0
#!/bin/bash
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')
CONFIG_JSON=$(mktemp)
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}
done
@wokamoto
wokamoto / file0.txt
Created March 2, 2018 11:57
[AWS] CloudFront が使用する IP レンジを調べる ref: https://qiita.com/wokamoto/items/fd9c064c3608912085c1
curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.service=="CLOUDFRONT")