This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sysctl -n machdep.cpu.brand_string | |
Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import XCPlayground | |
extension UIView { | |
public func addInnerShadow(topColor: UIColor = UIColor.blackColor().colorWithAlphaComponent(0.3)) { | |
let shadowLayer = CAGradientLayer() | |
shadowLayer.cornerRadius = layer.cornerRadius | |
shadowLayer.frame = bounds | |
shadowLayer.frame.size.height = 10.0 | |
shadowLayer.colors = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CoreFoundation | |
extension Array { | |
func firstMatchFilter<T: Equatable>(target: T) -> Element? { | |
let start = CFAbsoluteTimeGetCurrent() | |
guard let index = self.indexOf({ $0 as! T == target }) else { | |
return nil | |
} | |
let end = CFAbsoluteTimeGetCurrent() | |
print("elapsed time = \(end - start)") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Zabbix graph save script. | |
# Required PowerShell v3.0 or later. | |
# variables. | |
$zabbixURL = "http://192.168.0.10/zabbix/" | |
$zabbixAPIURL = $zabbixURL + "api_jsonrpc.php" | |
$zabbixGraphURL = $zabbixURL + "chart2.php?graphid=" | |
$baseJSON = @{ "jsonrpc" = "2.0"; "id" = 1 } | |
# Get login token. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# よく使うやつ。主に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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import winrm | |
import sys | |
import getopt | |
import json | |
# set default | |
host = "localhost" | |
credencial_file = "/etc/cacti/cactiwinrm.json" |