Skip to content

Instantly share code, notes, and snippets.

@tomhat
tomhat / thanks_redirect.js
Last active April 3, 2020 02:57
Mlritz 完了画面で商品タグから特定サイトへリダイレクトするシェル
(function(){
var TARGET_URL = 'https://example.com/items/';
var SUFFIX = '/?type=thanks';
var tagUID = [%comodity_tag_uid_list%];
for(var i = 0,len = tagUID.length;i < len;i++){
if( tagUID[i] == 1 ){
var itemID = '%productid%';
if( itemID.indexOf('-') >= 0 ){
itemID = itemID.substring(0,itemID.indexOf('-'));
}
@tomhat
tomhat / add_xparam.js
Last active April 2, 2020 10:32
Mlritz クロスドメインパラメータ引き継ぎ
(function(g){
var KEYNAME = 'yclid';
var TARGET_URL = 'https://www.mlritz.com/shop.php';
if( 'KEYNAME' in g ){
KEYNAME = g.KEYNAME;
}
if( 'TARGET_URL' in g ){
TARGET_URL = g.TARGET_URL;
}
DROOT="./"
SPORT="8111"
if [ "$1" != "" ]
then
DROOT="$1"
fi
if [ "$2" != "" ]
then
SPORT="$2"
fi
@tomhat
tomhat / app_logrotate.sh
Created March 10, 2020 09:58
Simple Application's LogRotate Shell
#!/bin/bash
logterm=14
logpath="***LOGPATH***"
logfile="app.log"
fullname=$logpath$logfile
newlogfilename=$logpath${logfile%.*}.`date '+%Y%m%d' -d "1 days ago"`.log
dellogfilename=$logpath${logfile%.*}.`date '+%Y%m%d' -d "$logterm days ago"`.log
cp $fullname $newlogfilename
@tomhat
tomhat / update_aide.sh
Created February 17, 2020 20:43
Update Aide+logging Shell Script
#!/bin/sh
LOGTIME=`date +'%Y%m%d'`
echo "start:`date +'%Y/%m/%d %H:%M:%S'`" >> /home/hatabo/shell/aide/aide$LOGTIME.log
/usr/sbin/aide --update >> /home/hatabo/shell/aide/aide$LOGTIME.log
echo "copy aide.db.new.gz => /var/lib/aide/aide.db.gz" >> /home/hatabo/shell/aide/aide$LOGTIME.log
/bin/cp /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
echo "start:`date +'%Y/%m/%d %H:%M:%S'`" >> /home/hatabo/shell/aide/aide$LOGTIME.log
@tomhat
tomhat / function_og.php
Created October 18, 2019 03:20
ExUnit og:image:width,og:image:height対応
<?php
add_post_type_support( 'page', 'excerpt' ); // add excerpt
/*
Add OGP
/*-------------------------------------------*/
add_action( 'wp_head', 'vkExUnit_print_og', 20 );
function vkExUnit_print_og() {
global $vkExUnit_sns_options;
@tomhat
tomhat / getRandomInt
Created October 8, 2019 01:39
範囲指定の乱数取得
function getRandomInt(min, max){
return Math.floor(Math.random() * (max - min + 1)) + min
}
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {
@tomhat
tomhat / count_mail.sh
Created February 2, 2017 17:24
Count send mail num per Hourly (one liner)
for i in 16 17 18 19 20 21 22; do echo ${i}:`cat ~/temp/maillog.20170203.csv |grep "^2016/02/01 ${i}:"|wc -l`; done;
@tomhat
tomhat / copy_maillog.sh
Created February 2, 2017 16:38
Copy From Remote maillog
#!/bin/sh
# sh copy_maillog.sh [hostfile list]
#
# HostFile List Format
#
# -----------------------
# RemoteUser Domain Port
# -----------------------
# ex)
# tomhat host1.example.com 22