Skip to content

Instantly share code, notes, and snippets.

View matchy256's full-sized avatar

MACHIDA Hideki matchy256

View GitHub Profile
@matchy256
matchy256 / wordpagenum.rb
Last active December 17, 2015 03:49
指定ディレクトリのすべてのWordファイルのフッタを「ページ番号/ページ数」にする (要 win32ole)
#!/usr/bin/env ruby
require 'win32ole'
abort("Usage: #{$0} WordFilesDirectory") if ARGV.length < 1
fso = WIN32OLE.new('Scripting.FileSystemObject')
wordFiles = []
Dir.foreach(ARGV[0]) do |f|
path = File.join(ARGV[0], f)
@matchy256
matchy256 / dropcaches.sh
Created December 21, 2012 02:08
Linux のスワップとかキャッシュとかをクリアする
#!/bin/sh
# swap clear
/sbin/swapoff -a && /sbin/swapon -a
# disk sync
/bin/sync
/bin/sync
/bin/sync
@matchy256
matchy256 / clamscan.sh
Last active December 9, 2015 21:59
ClamAV でシステム全体をスキャンして、問題があったらメールするスクリプト。 除外ディレクトリは /etc/clamscan.exclude ファイルに1行ずつ書いとく。/proc は入れといた方がいい。
#!/bin/bash
MAILTO="root"
PATH=/usr/bin:/bin
# excludeopt setup
excludelist=/etc/clamscan.exclude
if [ -s $excludelist ]; then
for i in `cat $excludelist`
do
@matchy256
matchy256 / web_alive.sh
Last active July 24, 2018 15:51
wget を使った Web 死活監視スクリプト
#!/bin/bash
if [ $# -eq 2 ]; then
URL=$1
MAILTO=$2
else
echo "usage : $0 check_url alert_mail_address"
exit 1
fi
@matchy256
matchy256 / rec_radiko.sh
Last active January 11, 2025 15:23 — forked from saiten/rec_radiko.sh
簡易Radiko録音スクリプト
#!/bin/bash
LANG=ja_JP.utf8
pid=$$
date=`date '+%Y-%m-%d-%H_%M'`
outdir="."
if [ $# -le 1 ]; then