Skip to content

Instantly share code, notes, and snippets.

View skihero's full-sized avatar

Kish skihero

  • Amazon Mechanical Turk
  • Ooty
View GitHub Profile
@skihero
skihero / ping.c
Created September 29, 2014 12:04
ping -c
if ping -c 1 "$host" > /dev/null 2>&1; then
@skihero
skihero / cfg_dir_nagios
Created September 29, 2014 06:31
cfg_dir_nagios
Format: cfg_file=<file_name>
Example: cfg_file=/usr/local/nagios/etc/hosts.cfg
cfg_file=/usr/local/nagios/etc/services.cfg
cfg_file=/usr/local/nagios/etc/commands.cfg
Actuals on the machine:
# object configuration files (see the cfg_file and cfg_dir options above).
@skihero
skihero / create_rrd_db
Created September 29, 2014 06:04
create_rrd_database snippet
sub create_rrd_database {
my $self = shift;
my ($RRDdatabase_path, $metric_id, $begin, $interval, $metric_name, $my_len_storage_rrd, $data_source_type) = @_;
my $lsource_type;
if (defined($data_source_type) && defined($rrd_dst[$data_source_type])) {
$lsource_type = $rrd_dst[$data_source_type];
} else {
$lsource_type = $rrd_dst[0];
@skihero
skihero / collectd_-n_types
Created September 12, 2014 10:11
collectd_-n_types
.
|-- lib
| `-- collectd
| `-- ${prefix}
| `-- var
| `-- lib
| `-- collectd
| `-- csv
| |-- cpu-0
| | |-- cpu-idle-2014-09-12
@skihero
skihero / seq_imp
Created September 10, 2014 06:34
simple seq imp stolen
#!/bin/bash
#set -x
seq () {
if [ -z "$3" ]; then
incr=1
j=$2
else
incr=$2
@skihero
skihero / gist:4f4c3e4e85a3bf986e51
Created July 19, 2014 19:55
sort based on the size (check KEY_DEF ranges in man)
skihero@tender /usr/lib64/chromium-browser $ ls -ltr|sort -k 5.1n
total 103740
-rwxr-xr-x 1 root root 1201 Mar 22 02:35 chromium-launcher.sh
drwxr-xr-x 2 root root 4096 Jul 5 23:23 locales
drwxr-xr-x 4 root root 4096 Jul 5 23:23 resources
-rw-r--r-- 1 root root 5662 Mar 22 02:35 chrome.pak
-rws--x--x 1 root root 18456 Mar 22 02:36 chrome-sandbox
-rw-r--r-- 1 root root 148506 Mar 22 02:35 content_resources.pak
-rw-r--r-- 1 root root 970106 Mar 22 02:35 chrome_100_percent.pak
-rwxr-xr-x 1 root root 2424312 Mar 22 02:36 libffmpegsumo.so
@skihero
skihero / gist:9928ebfa884892706404
Created July 9, 2014 10:53
code folding for java
autocmd FileType java :set fmr=/**,*/ fdm=marker fdc=1
@skihero
skihero / gist:a81890b0cdac13e2a634
Created July 6, 2014 13:05
iterate *.sh files
for sh in /etc/profile.d/*.sh ; do
[ -r "$sh" ] && . "$sh"
done
unset sh
# Set up PATH depending on whether we're root or a normal user.
# There's no real reason to exclude sbin paths from the normal user,
# but it can make tab-completion easier when they aren't in the
# user's PATH to pollute the executable namespace.
#
# It is intentional in the following line to use || instead of -o.
# This way the evaluation can be short-circuited and calling whoami is
# avoided.
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}"
import codecs
import os
import re
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
here = os.path.abspath(os.path.dirname(__file__))