Skip to content

Instantly share code, notes, and snippets.

Avatar

Kish skihero

View GitHub Profile
@skihero
skihero / AutoHotkey.ahk
Last active Jul 4, 2020
Bind Winkey and u to press Shift and up key x number of times
View AutoHotkey.ahk
*#c::Run Calc.exe
#n::
Run Notepad
return
#u::Send +{Up 10}
#j::Send +{Down 10}
#a::
Send {Home 20}
CoordMode, Mouse, Screen
View buff_tessy
from Tkinter import *
from PIL import Image, ImageTk, ImageDraw
import urllib2
IMG_URI = "https://raw.githubusercontent.com/skihero/cor3/master/image_sample.jpg"
IMG_NAME = "image_sample.jpg"
bbox = [ (16, 17, 118, 152),
View action_info_pg.pl
Quick hash to put normal action information in one place:
our $action_info = {
# Name # clusterwide? # helpstring
archive_ready => [1, 'Check the number of WAL files ready in the pg_xlog/archive_status'],
autovac_freeze => [1, 'Checks how close databases are to autovacuum_freeze_max_age.'],
backends => [1, 'Number of connections, compared to max_connections.'],
bloat => [0, 'Check for table and index bloat.'],
checkpoint => [1, 'Checks how long since the last checkpoint'],
cluster_id => [1, 'Checks the Database System Identifier'],
commitratio => [0, 'Report if the commit ratio of a database is too low.'],
@skihero
skihero / mem_info.pl
Created Nov 5, 2014
mem_info extraction in perl
View mem_info.pl
my @meminfo = `/bin/cat /proc/meminfo`;
foreach (@meminfo) {
chomp;
if (/^Mem(Total|Free):\s+(\d+) kB/) {
my $counter_name = $1;
@skihero
skihero / attributes_default.rb
Created Oct 27, 2014
attributes/default.rb
View attributes_default.rb
cat attributes/default.rb
# nrpe packge options
default['nrpe']['package']['options'] = nil
# nrpe daemon user/group
default['nrpe']['user'] = 'nagios'
default['nrpe']['group'] = 'nagios'
# config file options
default['nrpe']['allow_bash_command_substitution'] = nil
@skihero
skihero / nrpe.cfg.erb
Created Oct 27, 2014
templates/default/nrpe.cfg.erb
View nrpe.cfg.erb
cat templates/default/nrpe.cfg.erb
# Autogenerated by Chef.
<%= "log_facility=#{node['nrpe']['log_facility']}" unless node['nrpe']['log_facility'].nil? %>
<%= "allow_bash_command_substitution=#{node['nrpe']['allow_bash_command_substitution']}" unless node['nrpe']['allow_bash_command_substitution'].nil? %>
<%= "command_prefix=#{node['nrpe']['command_prefix']}" unless node['nrpe']['command_prefix'].nil? %>
pid_file=<%= node['nrpe']['pid_file'] %>
server_port=<%= node['nrpe']['server_port'] %>
<%= "server_address=#{node['nrpe']['server_address']}" unless node['nrpe']['server_address'].nil? %>
nrpe_user=<%= node['nrpe']['user'] %>
@skihero
skihero / nagios_nrpecheck
Created Oct 27, 2014
add or remove an nrpecheck
View nagios_nrpecheck
examples $ cat base_monitoring.rb
#
# Cookbook Name:: monitoring
# Recipe:: base_monitoring
#
# Copyright 2013, Example Company, Inc.
#
# This recipe defines the necessary NRPE commands for base system monitoring
# in Example Company Inc's Chef environment.
@skihero
skihero / include_dir_file
Created Oct 27, 2014
Include a conf directory and a file from the template, chef
View include_dir_file
include_dir = "#{node['nrpe']['conf_dir']}/nrpe.d"
directory include_dir do
owner node['nrpe']['user']
group node['nrpe']['group']
mode '0755'
end
template "#{node['nrpe']['conf_dir']}/nrpe.cfg" do
source 'nrpe.cfg.erb'
@skihero
skihero / gen_nagios_command_of_filesd
Created Oct 1, 2014
command conf construction helper nagios
View gen_nagios_command_of_filesd
# get a list of files
for f in `ls`
do
echo "command[${f}]=/usr/lib/nagios/plugins/${f} -H localhost -db apigee -u nagios --dbpass random_password # -w -c "
done
View ping.c
if ping -c 1 "$host" > /dev/null 2>&1; then
You can’t perform that action at this time.