Skip to content

Instantly share code, notes, and snippets.

View tckz's full-sized avatar
🌵

tckz

🌵
View GitHub Profile
@tckz
tckz / backup.sh
Created March 26, 2009 04:15
backup
#!/bin/sh
dir_backup_dst=/path/to/backup/`hostname`
timestamp=`date +%Y%m%d%H`
myname=`basename $0`
pid=$$
(
@tckz
tckz / ifdown-up.ps1
Created June 24, 2009 06:20
ifdown/up for windows
$sh = New-Object -ComObject Shell.Application
$nc = $sh.NameSpace(3).Items() | ? { $_.Name -eq "ネットワーク接続" }
$lan = $nc.GetFolder.Items() | ? { $_.Name -eq "ローカル エリア接続" }
$disable = $lan.Verbs() | ? { $_.Name -eq "無効にする(&B)" }
if($disable)
{
write-host "disabling."
$disable.DoIt()
}
@tckz
tckz / report_wsus.ps1
Created June 24, 2009 06:28
Report wsus computer targets which is important updates have not been installed yet.
param([switch]$nomail)
trap [Exception] {
$t = $error[0].ToString().Trim() + "`n" + $error[0].InvocationInfo.PositionMessage.Trim()
[Diagnostics.EventLog]::WriteEntry("report_wsus", $t, "Error", 1)
}
[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
$update_server = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer()
$update_server.PreferredCulture ="ja"
@tckz
tckz / registry.js
Created June 30, 2009 09:36
jscriptでレジストリ参照(リモート可)
var Registry = function () {
this.initialize.apply(this, arguments);
};
Registry.prototype = {
initialize: function(computer) {
var locator = new ActiveXObject("WbemScripting.SWbemLocator");
var server = locator.ConnectServer(computer, "root\\default");
this.stdregprov = server.Get("StdRegProv");
@tckz
tckz / approve_update.ps1
Created July 1, 2009 07:12
条件に合致したIUpdateをインストール承認する
param([switch]$nomail)
trap [Exception] {
$t = $error[0].ToString().Trim() + "`n" + $error[0].InvocationInfo.PositionMessage.Trim()
[Diagnostics.EventLog]::WriteEntry("approve_update", $t, "Error", 1)
}
[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
$update_server = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer()
$update_server.PreferredCulture ="ja"
@tckz
tckz / buiid.bat
Created September 11, 2009 02:02
OmegaTの訳文ファイル生成をコマンドラインで
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_15
set OMEGAT_HOME=c:\Program Files\OmegaT
cmd /c c:\path\to\ant\bin\ant.bat
pause
@tckz
tckz / change_mirror_state.ps1
Created December 8, 2009 09:50
SQLserverのデータベースミラーリングのフェイルオーバー
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | out-null
$server = new-object Microsoft.SqlServer.Management.Smo.Server("プリンシパルサーバ")
$db = $server.Databases["mirrortest"]
$db.ChangeMirroringState([Microsoft.SqlServer.Management.Smo.MirroringOption]::Failover)
@tckz
tckz / memo.ps1
Created December 9, 2009 07:35
Powershell+WMIでDNS操作
$dns = gwmi -Class MicrosoftDNS_server -Namespace Root\MicrosoftDNS -ComputerName DCコンピュータ名
$rrs = gwmi -Class MicrosoftDNS_ResourceRecord -Namespace Root\MicrosoftDNS -ComputerName DCコンピュータ名
@tckz
tckz / fetch_repos.sh
Created March 4, 2010 02:47
redmineのリポジトリ更新cronジョブ
#!/bin/sh
myname=`basename $0`
pid=$$
(
echo "fetch repos." 1>&2
cd /path/to/redmine/rails_root
env LANG=ja_JP.UTF-8 ruby script/runner "Repository.fetch_changesets" -e production
@tckz
tckz / authorized_keys
Created March 4, 2010 02:49
svn+sshでsvn専用アカウントの authorized_keys
command="svnserve -t -r /path/to/svn/repos --tunnel-user=som@example.com",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAA~~公開鍵の内容~~+DD2YeMmkOv0bCiL+w== some@example.com