Skip to content

Instantly share code, notes, and snippets.

@r-plus
r-plus / analyze_robocopy_log.py
Created August 3, 2014 03:49
Output file size and max length of filepath per division to csv from robocopy log.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Usage:
# script.py <robocopy.log> [robocopy.log]...
import re
from sys import argv
# key = division name
@r-plus
r-plus / SavedSpace.xml
Created January 27, 2015 09:27
Cacti templace - WindowsServer2012 Data Deduplication
<cacti>
<hash_0000248223b362bd688a74951a1ee6323e69d1>
<name>Windows - DedupSavedSpace(WMI)</name>
<graph>
<t_title>on</t_title>
<title>|host_description| - DedupSavedSpace</title>
<t_image_format_id></t_image_format_id>
<image_format_id>1</image_format_id>
<t_height></t_height>
<height>120</height>
@r-plus
r-plus / SQL_DB_Size.py
Created February 2, 2015 09:39
Get SQL Server space usage data for cacti monotoring via WinRM.
#!/usr/bin/env python
import winrm
import sys
import getopt
import json
# set default
host = "localhost"
credencial_file = "/etc/cacti/cactiwinrm.json"
@r-plus
r-plus / Cacti_Template_DNS_WMI.xml
Last active August 29, 2015 14:14
Cacti templace - DNS received query request/sec for Windows via WMI
<cacti>
<hash_0000247a26072efb1c6c5b9358fa308220a69a>
<name>Windows - DNS(WMI)</name>
<graph>
<t_title>on</t_title>
<title>|host_description| - DNS</title>
<t_image_format_id></t_image_format_id>
<image_format_id>1</image_format_id>
<t_height></t_height>
<height>120</height>
@r-plus
r-plus / GetSystemSettings.ps1
Last active August 29, 2015 14:16
Get general settings of Windows for individual test.
# This script required administrator permission.
# Disk, Partition and Firewall getting cmdlet require 2012 or later.
$LOG = "C:\$(hostname)_OS_Test_$((Get-Date -Format d).Replace('/','')).log"
function EchoTitle($title)
{
echo ""
echo "******************** ${title} ********************"
echo ""
@r-plus
r-plus / vfp_used_size.ps1
Last active August 29, 2015 14:22
Script to get HVFP filesystem used size via http api.
# Script to get HVFP filesystem used size via http api.
# API Refference: http://itdoc.hitachi.co.jp/Pages/document_list/manuals/vfp.html
$filesystem = "FS01"
# [System.Web.HttpUtility] for japanese UrlEncode if necessary.
#[void]([Reflection.Assembly]::LoadWithPartialName("System.Web"))
# Ignore warning about self signed SSL cert.
[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
@r-plus
r-plus / ro.ps1
Last active August 29, 2015 14:22
Add everyone read-only ACE to target path.
# Add everyone read-only ACE to target path.
# Doc: https://technet.microsoft.com/en-us/library/ff730951.aspx
function Add-ReadOnlyACE([string]$path)
{
if (-not (Test-Path $path)) { return }
# Create additionnal ACE.
$colRights = [System.Security.AccessControl.FileSystemRights]"AppendData, ChangePermissions, CreateDirectories, CreateFiles, Delete, DeleteSubdirectoriesAndFiles, Write"
$InheritanceFlag = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit, ObjectInherit"
$PropagationFlag = [System.Security.AccessControl.PropagationFlags]::None
@r-plus
r-plus / frequent_commands.ps1
Created September 9, 2015 01:37
note for future use.
# よく使うやつ。主にStartTime見る用
Get-Process -Name 'winlogon' | Format-Table -AutoSize -Property Name, StartTime, Id, PM, VM, WS
# Service. StartModeが取れないダメCmdlet。そっちが目的ならGet-WmiObject
Get-Service | format-table -Autosize -Property DisplayName, Name, Status
# Get-ServiceでPIDが取れないのでWMIを使わざるを得ない。大体タスクマネージャーから確認した方が早い。
Get-Process -Id (Get-WmiObject -Query "select * from win32_service where name='wuauserv'").ProcessId | Format-Table Name, StartTime
//ActionMenu Daijirin Plugin.
//2010/10/10 r_plus create.
//version 0.1-1
#import <UIKit/UIKit.h>
#import "ActionMenu.h"
@implementation UIResponder (Daijirin)
- (void)doDaijirin:(id)sender
@r-plus
r-plus / Tweak.xm
Created March 5, 2011 14:58
get active tab URL method of mobilesafari.
@interface UIApplication (SafariActiveURL)
- (id)activeURL;
//maybe return NSString class
@end
//...
id activeURL = [[UIApplication sharedApplication] activeURL];