Skip to content

Instantly share code, notes, and snippets.

View kmamiya's full-sized avatar
🐇

Kentarou Mamiya kmamiya

🐇
View GitHub Profile
@kmamiya
kmamiya / compoment_sync_test.html
Created January 29, 2020 01:25
memo; Vue.js created() function in each components isnot syncronized execution.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<title>memo; Vue.js created() function in each components isnot syncronized execution.</title>
<script
src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity="sha256-pasqAKBDmFT4eHoN2ndd6lN370kFiGUFyTiUHWhU7k8="
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
@kmamiya
kmamiya / .bashrc
Created October 13, 2018 15:41
check tmux session, attach it if exists, else set enviroment and start new tmux session.
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
@kmamiya
kmamiya / sample.html
Created January 21, 2018 04:35
In Vue.js, set the valid initial value to <input type = "date">.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>
<div id="root">
<input type="date" v-model="today" />
</div>
@kmamiya
kmamiya / AttachmentController.php
Created April 10, 2017 14:39
CakePHP+AJaxでファイルアップロードする実装のメモ。
<?php
App::uses('AppController', 'Controller');
class AttachmentController extends AppController
{
public $uses = false;
public function index()
{
if ($this->request->is('ajax')) {
@kmamiya
kmamiya / list_diskimage_sample.py
Created December 3, 2016 01:37
The sample code for getting disk-image list from ConoHa with my conoha library that released as kmamiya/serverless-email-send-tool
# 1. $ git clone 'https://github.com/kmamiya/serverless-email-send-tool.git'
# 2. cd serverless-email-send-tool/bin
# 4. Rename or copy from config.json.template
# 5. Edit config.json
# 6. Download this.
# 7. $ python list_diskimage_sample.py config.json
#
from conoha import ConoHa
@kmamiya
kmamiya / get_twitter_timeline.js
Created October 14, 2016 14:20
Test program of getting twitter timeline with the "application-only auth" authorization. (This can execute on GAS)
function myFunction() {
var key = 'Consumer Key (API Key)';
var secret = 'Consumer Secret (API Secret)';
var base64_token = Utilities.base64Encode( key + ':' + secret );
var response = UrlFetchApp.fetch(
'https://api.twitter.com/oauth2/token',
{
'method': 'POST',
'contentType': 'application/x-www-form-urlencoded;charset=UTF-8',
@kmamiya
kmamiya / get_japan_holiday.js
Created September 22, 2016 15:00
ICS parser sample.
// Google提供の「日本の祝日」カレンダーから、今年の分だけを抽出するサンプル。
//
// Example;
// $ npm install
// $ node get_japan_holiday.js
//
var ICal = require( 'ical' );
var HOLIDAY_CALENDAR_URL =
'https://www.google.com/calendar/ical/ja.japanese%23holiday%40group.v.calendar.google.com/public/basic.ics';
@kmamiya
kmamiya / wordpress.conf
Created September 14, 2016 07:37
Apache config file (in /etc/httpd/conf.d) for Wordpress with php-fpm.
<VirtualHost *:80>
ServerName [hostname]
DocumentRoot /var/www/wordpress
ProxyPassMatch ^(.*\*.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/wordpress/$1
<Directory "/var/www/wordpress">
Options +FollowSymlinks +ExecCGI
DirectoryIndex index.html index.php
AllowOverride All
</Directory>
@kmamiya
kmamiya / build_php7_on_centos7.sh
Last active March 19, 2018 00:51
Build PHP 7.2.3 on CentOS 7.4
#!/bin/sh
sudo yum install zlib zlib-devel mariadb mariadb-server mariadb-devel gd gd-devel curl curl-devel openssl openssl-devel libxml2 libxml2-devel systemd-devel mcrypt libmcrypt libmcrypt-devel
./configure --prefix=/usr/local/php-7.2.3 --sysconfdir=/etc --localstatedir=/var --with-mysqli=/usr/bin/mysql_config --enable-fpm --with-fpm-systemd --enable-mbstring --enable-zip --with-gd --with-zlib --with-curl --with-pdo-mysql --with-jpeg-dir --with-openssl --with-mcrypt
make
make test
# sudo make install
# sudo cp -p sapi/fpm/php-fpm.service /etc/systemd/system
## Rewrite "${exec_prefix}" to "/usr/local/php-7.2.3/" in /etc/systemd/system/php-fpm.service
@kmamiya
kmamiya / php-fpm.conf (etc)
Last active January 6, 2016 05:42
php-fpm setting (memo)
# diff /usr/local/php-7.0.1/etc/php-fpm.conf.default /etc/php-fpm/conf
81c81
< ;daemonize = yes
---
> daemonize = no
125c125
< include=/usr/local/php-7.0.1/etc/php-fpm.d/*.conf
---
> include=/etc/php-fpm.d/*.conf