Skip to content

Instantly share code, notes, and snippets.

smeghead

Block or report user

Report or block smeghead

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@smeghead
smeghead / BusyProcess.vb
Created Nov 19, 2015
Windows Forms で、処理中カーソルの後始末を IDisposable を使って行なう。
View BusyProcess.vb
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 / crontab-backup.sh
Created May 22, 2014
crontab 設定のバックアップスクリプト(履歴付き)
View crontab-backup.sh
#!/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 / gist:11205195
Created Apr 23, 2014
testの戻り値がtrueになってから、procを実行する関数
View gist:11205195
var execAfter = function(test, proc) {
var timer = setInterval(function(){
if (test()) {
clearInterval(timer);
proc();
return;
}
}, 500);
};
@smeghead
smeghead / missing_modules.pl
Created Jul 16, 2012
check missing modules.
View missing_modules.pl
#!/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`;
View gist:2651925
find . -name '*.ext' | xargs -n 1 perl -pi.bak -e 's/before string/after string/'
@smeghead
smeghead / rename.sh
Created Apr 25, 2012
拡張子の変更
View rename.sh
for f in *.php; do n=${f%.*}; mv $n.php $n.tx; done;
@smeghead
smeghead / ja.po
Created Apr 20, 2012
Locale::Maketext::Simpleが動かない
View ja.po
msgid "hello"
msgstr "konnnitiwa"
@smeghead
smeghead / sslcert-check
Created Nov 10, 2011
check ssl cert expire.
View sslcert-check
#!/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
View fib.clj
(defn fib [n]
(cond
(< n 0) (throw (IllegalArgumentException. "fib argument must be plus number."))
(= n 1) 1
(= n 2) 1
:else (+ (fib (- n 2)) (fib (- n 1)))))
(loop [x 1]
(if (< x 10)
(do
View sample.clj
(defn hogehoge [x]
(let [x 0
y 0]
hoge)
(fn [x 0
y 0]
(+ x y)))
You can’t perform that action at this time.