Skip to content

Instantly share code, notes, and snippets.

Moorthy RS rsmoorthy

  • Bangalore
Block or report user

Report or block rsmoorthy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
rsmoorthy /
Last active Nov 21, 2018
Raspberry PI - Switch between Hotspot and Wifi modes
View es640_fails_to_start
[2018-10-12T19:39:21,050][INFO ][o.e.n.Node ] [] initializing ...
[2018-10-12T19:39:21,111][INFO ][o.e.e.NodeEnvironment ] [5awoLm1] using [1] data paths, mounts [[/var/lib/elasticsearch (/dev/nvme1n1)]], net usable_space [229.1gb], net total_space [1.4tb], types [ext4]
[2018-10-12T19:39:21,111][INFO ][o.e.e.NodeEnvironment ] [5awoLm1] heap size [19.9gb], compressed ordinary object pointers [true]
[2018-10-12T19:39:22,670][INFO ][o.e.n.Node ] [5awoLm1] node name derived from node ID [5awoLm1yQ0yOkBdLy3FTzQ]; set [] to override
[2018-10-12T19:39:22,670][INFO ][o.e.n.Node ] [5awoLm1] version[6.4.0], pid[95], build[default/tar/595516e/2018-08-17T23:18:47.308994Z], OS[Linux/3.10.0-862.11.6.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_181/25.181-b13]
[2018-10-12T19:39:22,670][INFO ][o.e.n.Node ] [5awoLm1] JVM arguments [-Xms20g, -Xmx20g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSIniti
View es541_cluster_allocation_explain
# curl -XGET localhost:9200/_cluster/allocation/explain?pretty
"index" : "filebeat-2017.09.08",
"shard" : 0,
"primary" : true,
"current_state" : "unassigned",
"unassigned_info" : {
"at" : "2018-10-12T19:09:07.740Z",
"last_allocation_status" : "no_valid_shard_copy"
rsmoorthy /
Last active Oct 7, 2018
Async Timer Example
import asyncio
class AsyncTimer:
def __init__(self, timeout, func, repeat=False, loop=None):
self.loop = loop
self._timeout = timeout
self._func = func
self._repeat = repeat
if loop:
self._task = loop.create_task(self._job())
#!/usr/bin/env python
# This python script gets the cloudtrail logs and stores in /var/log/cloudtrail/
# cloudtrail.log. This fetches AND parses the following AWS logs and stores in files.
# a) CloudTrail logs (JSON gzipped)
# b) S3 Access Logs
# c) ELB Access Logs
# It can incrementally get only the new modified access logs (of any of the above) and append to existing files.
import boto3
rsmoorthy / match_ip.go
Last active Nov 3, 2015
Go: Match any interfaces/IP address for the corresponding CIDR provided
View match_ip.go
package main
import (
func matchCIDR(in_cidr string) (bool) {
_, in_net, err := net.ParseCIDR(in_cidr)
rsmoorthy /
Created Feb 3, 2015
sails-hook-extmodel: Sails.js hook for extending Models

fw Extended Models

This hook extends the models, its definition and its behaviour.

For now, various features will get added in this hook. And we will migrate them to proper ones, as we go by.

Extended enum support

This feature extends the values of enum from other sources. Other sources could be:

You can’t perform that action at this time.