Skip to content

Instantly share code, notes, and snippets.

@komeda-shinji
komeda-shinji / check_reachable_by_mtr
Created December 13, 2017 08:37
check_reachable の mtr を使ったバージョン: mtr のバージョンは 0.84 以降が必要
#!/bin/bash
NAGIOS_OK=0
NAGIOS_WARNING=1
NAGIOS_CRITICAL=2
NAGIOS_UNKNOWN=3
PROGNAME="check_reachable"
VERSION="1.0"
@komeda-shinji
komeda-shinji / stub_sftp.py.patch
Created November 28, 2017 10:16
S3バケットへのアップロードを行うsftp proxyサーバ。https://github.com/rspivak/sftpserver に対するパッチになっている。
diff -u stub_sftp.py stub_sftp.py
--- stub_sftp.py 2016-03-07 07:14:09.000000000 +0900
+++ stub_sftp.py 2016-05-12 23:31:30.000000000 +0900
@@ -22,8 +22,35 @@
import os
from paramiko import ServerInterface, SFTPServerInterface, SFTPServer, SFTPAttributes, \
- SFTPHandle, SFTP_OK, AUTH_SUCCESSFUL, OPEN_SUCCEEDED
+ SFTPHandle, SFTP_OK, SFTP_FAILURE, AUTH_SUCCESSFUL, OPEN_SUCCEEDED
@komeda-shinji
komeda-shinji / file0.txt
Last active July 18, 2017 09:03
LibreNMSでポート一覧から無効にしているポートを除外して表示したい ref: http://qiita.com/komeda-shinji/items/6006be5cf53bf7dd55f4
diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php
index 4110d66..7a66326 100644
--- a/html/pages/device/ports.inc.php
+++ b/html/pages/device/ports.inc.php
@@ -12,6 +12,23 @@ if (!$vars['view']) {
$vars['view'] = trim($config['ports_page_default'], '/');
}
+$quickfilter_conditions = array(
+ 'down' => FALSE,
@komeda-shinji
komeda-shinji / paren.sh
Created July 7, 2017 07:33
括弧の対応を表示
showmatch()
{
parens=''
expect=''
str="$1"
paired=''
echo "showmatch $str" >&2
while [ -n "$str" ]
do
match=$(expr "$str" : '\([^][}{)(]*[][}{)(]\).*')
@komeda-shinji
komeda-shinji / file0.txt
Created November 29, 2016 09:01
TeamPassのitem一覧でdescriptionのトリミングがマルチバイトを理解しない問題の対策 ref: http://qiita.com/komeda-shinji/items/896ef0306b59ad3622da
sources/items.queries.php- sources/items.queries.php
--- sources/items.queries.php- 2016-08-16 05:03:17.000000000 +0900
+++ sources/items.queries.php 2016-11-29 17:53:16.128242854 +0900
@@ -314,7 +314,7 @@
'&nbsp;<a id="fileclass'.$newID.'" class="file" onclick="AfficherDetailsItem(\''.$newID.'\', \'0\', \'\', \'\', \'\', \'\', \'\')" ondblclick="AfficherDetailsItem(\''.$newID.'\', \'0\', \'\', \'\', \'\', true, \'\')">' .
stripslashes($dataReceived['label']);
if (!empty($dataReceived['description']) && isset($_SESSION['settings']['show_description']) && $_SESSION['settings']['show_description'] == 1) {
- $html .= '&nbsp;<font size=2px>['.strip_tags(stripslashes(substr(cleanString($dataReceived['description']), 0, 30))).']</font>';
+ $html .= '&nbsp;<font size=2px>['.strip_tags(stripslashes(mb_substr(cleanString($dataReceived['description']), 0, 30))).']</font>';
}
@komeda-shinji
komeda-shinji / ios.py.patch
Created November 15, 2016 14:44
ansible IOS telnet support
diff -u ansible/module_utils/ios.py ansible/module_utils/ios.py
--- ansible/module_utils/ios.py 2016-05-11 16:27:12.000000000 +0900
+++ ansible/module_utils/ios.py 2016-05-18 21:57:24.000000000 +0900
@@ -21,11 +21,13 @@
NET_COMMON_ARGS = dict(
host=dict(required=True),
- port=dict(default=22, type='int'),
+ port=dict(type='int'),
username=dict(required=True),
@komeda-shinji
komeda-shinji / curl-local.spec
Created March 4, 2016 08:41
CentOS6 で Zabbix 3.0 を動かす (自力ビルド編)
%define _prefix /usr/local
%define _exec_prefix %{_prefix}
%define _datadir %{_prefix}/share
%define _libdir %{_exec_prefix}/lib64
%define _mandir %{_datadir}/man
%define dist .el6.local
Summary: A utility for getting files from remote servers (FTP, HTTP, and others)
Name: curl
#!/usr/bin/perl
while (<>) {
if (/^\S/ && $text_block) {
undef $text_block;
print "}}}\n";
}
if (m!^//!) {
s/^/##/; print; next;
}
if (/^#contents/) {
@komeda-shinji
komeda-shinji / retext.patch
Created July 23, 2015 12:36
ReText patch
diff -u ReText/__init__.py- ReText/__init__.py
--- ReText/__init__.py- 2014-07-26 17:12:13.000000000 +0900
+++ ReText/__init__.py 2014-10-07 15:54:53.000000000 +0900
@@ -32,7 +32,10 @@
except enchant.errors.Error:
enchant_available = False
-icon_path = "icons/"
+#icon_path = "icons/"
+from distutils.sysconfig import get_python_lib
@komeda-shinji
komeda-shinji / aws-cli-func.py
Created July 22, 2015 09:25
aws cli のドライバーを直接呼び出す
#!/usr/bin/env python
from botocore.compat import OrderedDict
from botocore import xform_name
from botocore.hooks import HierarchicalEmitter
from botocore.paginate import PageIterator
import botocore.session
import awscli.clidriver
from awscli import EnvironmentVariables
from awscli.plugin import load_plugins