Skip to content

Instantly share code, notes, and snippets.

@smeghead
smeghead / sslcert-check
Created November 10, 2011 01:01
check ssl cert expire.
#!/bin/sh
if [ $# == 0 ]; then
echo "usage: $1 <ssl cert file>"
exit 1
fi
FILENAME=$1
if [ ! -f "$FILENAME" ]; then
echo "ERROR: <ssl cert file> not exists. $FILENAME"
exit 1
@smeghead
smeghead / ja.po
Created April 20, 2012 14:50
Locale::Maketext::Simpleが動かない
msgid "hello"
msgstr "konnnitiwa"
@smeghead
smeghead / rename.sh
Created April 25, 2012 07:59
拡張子の変更
for f in *.php; do n=${f%.*}; mv $n.php $n.tx; done;
@smeghead
smeghead / gist:2651925
Created May 10, 2012 08:41
一括置換
find . -name '*.ext' | xargs -n 1 perl -pi.bak -e 's/before string/after string/'
@smeghead
smeghead / missing_modules.pl
Created July 16, 2012 15:12
check missing modules.
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use Data::Dumper;
die 'no argument.' if scalar @ARGV < 1;
my $check_path = $ARGV[0];
my $uses = `fgrep -r 'use ' $check_path | sed -e 's/.*use \\([A-Z][a-zA-Z0-9:]\\+\\).*/\\1/' | grep -v '^/' | sort | uniq`;
@smeghead
smeghead / gist:11205195
Created April 23, 2014 07:04
testの戻り値がtrueになってから、procを実行する関数
var execAfter = function(test, proc) {
var timer = setInterval(function(){
if (test()) {
clearInterval(timer);
proc();
return;
}
}, 500);
};
@smeghead
smeghead / crontab-backup.sh
Created May 22, 2014 02:44
crontab 設定のバックアップスクリプト(履歴付き)
#!/bin/sh
dir=$(dirname $0)
backup_dir=$dir/../backup/crontab
mkdir -p $backup_dir
cp $backup_dir/crontab-backup $backup_dir/crontab-backup.1
crontab -l > $backup_dir/crontab-backup
diff -Nu $backup_dir/crontab-backup.1 $backup_dir/crontab-backup >> $backup_dir/crontab-history
@smeghead
smeghead / BusyProcess.vb
Created November 19, 2015 06:50
Windows Forms で、処理中カーソルの後始末を IDisposable を使って行なう。
Namespace Utils
Public Class BusyProcess
Implements IDisposable
Private form As Form
Public Sub New(form As Form)
Me.form = form
Me.form.Cursor = Cursors.WaitCursor
End Sub
Public Sub Dispose() Implements IDisposable.Dispose
@smeghead
smeghead / radio-fail.html
Created February 7, 2020 01:00
Semantic UI のラジオボタンのvalidationエラーメッセージの挙動の変更
<!DOCTYPE html>
<html>
<head>
<!-- Standard Meta -->
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<!-- Site Properties -->
@smeghead
smeghead / rust-sandbox-read-csv.rs
Created January 26, 2021 04:45
rust-sandbox-read-csv
use std::env;
use std::fs::File;
use std::io::prelude::*;
#[derive(Debug)]
struct Organization<'a> {
id: &'a str,
name: &'a str,
}
fn main() {