Skip to content

Instantly share code, notes, and snippets.

View Nick011's full-sized avatar

Nick Hagianis Nick011

View GitHub Profile
@Nick011
Nick011 / gist:15d5f19d029c18440243
Last active August 29, 2015 14:15
JavaScript Tools
Build:
http://gulpjs.com/
http://browserify.org/
Frameworks:
http://facebook.github.io/react/
https://angularjs.org/
Graphing:
http://d3js.org/

Keybase proof

I hereby claim:

  • I am Nick011 on github.
  • I am nhagianis (https://keybase.io/nhagianis) on keybase.
  • I have a public key whose fingerprint is 56DF 8D05 625D 1F89 4E92 721F E94F 9C1A 0570 5439

To claim this, I am signing this object:

# Setup
import requests
api_key = 'apyvBhYVkl4li2QEajBhV6MwgNv1UT1w7M6W5jpX'
username = 'api-a68a23fdc61b4b9ab39ccd3633bf5e6b'
password = '(Your API Password)'
header = {
'x-api-key': api_key
}
base_url = 'https://api.perch.rocks/v1'
auth_url = base_url + '/auth/access_token'
import requests
res = requests.get('http://localhost:9201/_cat/indices?format=json')
src_indices = res.json()
src_indices = [item['index'] for item in src_indices if not 'monitoring' in item['index']]
body = {
'source': {
'remote': {
SELECT a.datname,
l.relation::regclass,
l.transactionid,
l.mode,
l.GRANTED,
a.usename,
a.query,
a.query_start,
age(now(), a.query_start) AS "age",
a.pid
SELECT a.datname,
l.relation::regclass,
l.transactionid,
l.mode,
l.GRANTED,
a.usename,
a.query,
a.query_start,
age(now(), a.query_start) AS "age",
a.pid
@Nick011
Nick011 / gist:ce4328cc1ad03a5d572d4c0728689d43
Created May 13, 2019 15:57
Postgres: query will check for queries blocked while waiting for a lock
SELECT
blocked_locks.pid AS blocked_pid,
blocked_activity.usename AS blocked_user,
blocking_locks.pid AS blocking_pid,
blocking_activity.usename AS blocking_user,
blocked_activity.query AS blocked_statement,
blocking_activity.query AS current_statement_in_blocking_process
FROM pg_catalog.pg_locks blocked_locks
JOIN pg_catalog.pg_stat_activity blocked_activity
ON blocked_activity.pid = blocked_locks.pid
# Version Info
GET /
################
# Cluster info #
################
# General cluster health
GET _cluster/health
# Warning: I have not tested this
import requests
from datetime import datetime, timedelta
api_key = '(Your API Key)'
username = '(Your API Username)'
password = '(Your API Password)'
header = {
'x-api-key': api_key
}
@Nick011
Nick011 / gist:3055316b65a83ff2883942614f0ea10c
Created June 9, 2020 19:18
Consume directly from kafka
kaf consume inbound_persist_topic --raw | grep "Something" | grep "event_type: log" | jq