Skip to content

Instantly share code, notes, and snippets.

@komeda-shinji
komeda-shinji / etckeeper.patch
Last active December 28, 2020 18:26
AWS CloudShell etckeeper patch
diff --git a/Makefile b/Makefile
index 73d2411..48e19af 100644
--- a/Makefile
+++ b/Makefile
@@ -3,8 +3,10 @@
CONFFILE=etckeeper.conf
include $(CONFFILE)
-DESTDIR?=
-prefix=/usr
@komeda-shinji
komeda-shinji / cli-comm-copy
Last active May 22, 2018 01:16
JAWS-UG CLI 専門支部のハンズオンテキストのコマンド部分をワンクリックでコピー可能にするブックマークレット
javascript:(function(){ var p = window.document.getElementsByTagName("pre"); for (var i = 0; i < p.length; i++) { var pre = p[i]; pre.onclick = function() { document.execCommand("copy"); }; pre.addEventListener("copy", function(event) { event.preventDefault(); if (event.clipboardData) { event.clipboardData.setData("text/plain", event.target.textContent); event.target.style.backgroundColor = "#a0a0ff"; window.setTimeout(function(){ event.target.style.backgroundColor = "#f0f0f0"; }, 500); } } ); } })()
@komeda-shinji
komeda-shinji / ec2DescribeInstances.go
Created May 3, 2018 13:08
goでのec2.DescribeInstancesテストコード
package main
import (
"fmt"
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/service/ec2"
@komeda-shinji
komeda-shinji / html2ipynb.py
Last active September 10, 2018 01:38
JAWS-UG CLI 専門支部のハンズオンテキストを Jupyter Notebook 上で実行できるようにする
#!/usr/bin/env python
import json
import urllib.request
import lxml.html
import html2text
from urllib.parse import urlparse, urljoin
import sys
crawl_url = {}
#!/usr//bin/env python
#
# This code is based collectd-network-client-python, forked from https://github.com/appliedsec/collectd
#
import sys
import awscli.clidriver
import StringIO
import json
diff -u kernel.py.orig kernel.py
--- kernel.py.orig 2018-04-07 21:45:29.000000000 +0900
+++ kernel.py 2018-04-07 21:46:30.000000000 +0900
@@ -4,6 +4,7 @@
from subprocess import check_output
import os.path
+import os
import re
@komeda-shinji
komeda-shinji / includes.discovery.mempools.yamaha-rt-hardware.inc.php
Created December 13, 2017 09:04
LibreNMS YAMAHA 対応 (html/images/os/yamaha.png にロゴファイルを置くと良い)
<?php
if ($device['os'] == "yamaha")
{
$percent = snmp_get($device, ".1.3.6.1.4.1.1182.2.1.4.0", "-OvQ");
if (is_numeric($percent))
{
$total = snmp_get($device, ".1.3.6.1.4.1.1182.2.1.2.0", "-OvQ");
discover_mempool($valid['mempool'], $device, 0, $mib, "Memory Utilization", "1", $total, $total*$percent/100.0);
@komeda-shinji
komeda-shinji / device-ports-filter.diff
Created December 13, 2017 08:59
LibreNMS device ports filter
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 / observium-collectd-oracle.patch
Created December 13, 2017 08:40
Collectd で取得した Oracle の統計情報を、Apps のところに表示するパッチ
Fri Jul 11 22:29:02 JST 2014 [email protected]
* oracle
diff -rN -u old-observium/html/includes/graphs/application/oracle_blks.inc.php new-observium/html/includes/graphs/application/oracle_blks.inc.php
--- old-observium/html/includes/graphs/application/oracle_blks.inc.php 1970-01-01 09:00:00.000000000 +0900
+++ new-observium/html/includes/graphs/application/oracle_blks.inc.php 2014-12-19 23:15:50.000000000 +0900
@@ -0,0 +1,46 @@
+<?php
+
+include("includes/graphs/common.inc.php");
+
#!/bin/bash
NAGIOS_OK=0
NAGIOS_WARNING=1
NAGIOS_CRITICAL=2
NAGIOS_UNKNOWN=3
PROGNAME="check_reachable"
VERSION="1.0"