Skip to content

Instantly share code, notes, and snippets.

Hemanth B hemanth22

  • Societe Generale Global Solution Centre.
  • Banglore
View GitHub Profile
@hemanth22
hemanth22 / HistorySettings.md
Created Mar 10, 2019
How to configure history in centos
View HistorySettings.md

First execute below command.

[bhemanth@localhost ~]$ set | grep HIST

Commnd Output.

HISTCONTROL=ignoredups
HISTFILE=/home/bhemanth/.bash_history
HISTFILESIZE=1000
@hemanth22
hemanth22 / bash.sh
Created Feb 16, 2019 — forked from macghriogair/bash.sh
[Elasticsearch stats] #elasticsearch #cat
View bash.sh
curl localhost:9200/_stats | python -m json.tool
# specific indices only
curl localhost:9200/index1,index2/_stats | python -m json.tool
# CAT all indices pretty format
curl 'localhost:9200/_cat/indices?format=json&pretty'
@hemanth22
hemanth22 / ElasticSearch.md
Created Feb 16, 2019 — forked from Integralist/ElasticSearch.md
[ElasticSearch] #elasticsearch
View ElasticSearch.md
curl -XPUT 'localhost:9200/foo/bar/1?pretty' -d '{"name": "Elasticsearch Denver", "organizer": "Lee"}'

Response...

{
  "_index" : "foo",
  "_type" : "bar",
View Elastic.md

The Elastic Stack

Intro

Welcome to Friday afternoon L&D. This afternoon is going to be on the Elastic Stack. For those of you who dont know, the Elastic Stack is what was previously reffered to as ELK (ElasticSearch, Logstash and Kibana). It was changed because its more of a stack of applications now as opposed to 3 specific applications.

This session is going to be unstructed, there is no presentation, its going to be switching between notes, the browser, some code, config file and me rambling.

If you have questions PLEASE shout out when the question enters your brain, dont wait until the end/break in a sentence and there is no such thing as an irrelevant question...learning things like this can be thought of as a foundation of bricks, if there is a brick missing this could lead to misunderstandings futher down the line.

View butler.playbook
---
- hosts: localhost
remote_user: root
roles:
- hemanth22.butler
View ansible-galaxy-find-role-id.sh
$ ansible-galaxy info YourUser.RoleName | grep -E 'id: [0-9]' | awk {'print $2'}
@hemanth22
hemanth22 / notify_ifttt_by_user.py
Created Jan 19, 2019 — forked from JonnyWong16/notify_ifttt_by_user.py
Send an IFTTT notification for a specific username
View notify_ifttt_by_user.py
### WARNING: This script has not been tested! ###
# 1. Install the requests module for python.
# pip install requests
# 2. Add script arguments in PlexPy.
# {user} {action}
import requests
import sys
user = sys.argv[1]
@hemanth22
hemanth22 / speedtest.py
Created Jan 19, 2019 — forked from sgobin/speedtest.py
Usando uma raspberry e speedtest.net para medir a velocidade da internet e salvar em uma planilha do Google via IFTTT
View speedtest.py
import os
import re
import subprocess
import time
import requests
#Usa um Webhook do IFTTT
URL = 'https://maker.ifttt.com/trigger/{NOME DO TRIGGER}/with/key/{CHAVE}'
#speedtest-cli => pip install speedtest-cli
View ifttt.py
import requests
key = 'eusNIu1EsTDCwSBRwh4-m3_UfoPvkN2eVfYfaNIEZ4Z'
def send_text(message):
requests.get('https://maker.ifttt.com/trigger/{}/with/key/{}'.format('send_text',key), data={'value1':message})
def send_email(subject, message):
requests.get('https://maker.ifttt.com/trigger/{}/with/key/{}'.format('send_email',key), data={'value1':subject, 'value2':message})
View ifttt.sh
#!/bin/bash
CURL=/usr/bin/curl
IFTTT_EVENT="$1"
IFTTT_KEY="XXXXXXXXXXXXXXXXXXXXX"
IFTTT_URL="https://maker.ifttt.com/trigger/${IFTTT_EVENT}/with/key/${IFTTT_KEY}"
${CURL} -X POST \
${IFTTT_URL} \
--header "Content-Type: application/json" \
--data-binary "{\"value1\": \"$2\",\"value2\": \"$3\",\"value3\": \"$4\"}"
You can’t perform that action at this time.