Skip to content

Instantly share code, notes, and snippets.

View init.el
(use-package gist
:ensure
:bind (("C-c a g l" . gist-list)
("C-c a g b" . gist-buffer)
("C-c a g B" . gist-buffer-private)
("C-c a g r" . gist-region)
("C-c a g R" . gist-region-private)))
@slackorama
slackorama / fun-with-jq.sh
Created May 11, 2016
Get the master that each node is using
View fun-with-jq.sh
for h in $list_of_es_hosts; do
echo -n "$h ";
curl -s http://$h:9200/_cluster/state/master_node,nodes | \
jq '.master_node as $master | .nodes[$master].name';
done
@slackorama
slackorama / *snippet*.sh
Last active Mar 18, 2016
Convert elasticsearch _search results to a table using csvtoolkit.
View *snippet*.sh
curl ... | \
jq '[.hits.hits[]._source | {"bucket": .bucketStart,
"rate": .totalBitRate, "cnt": .bitRateCnt}]' | \
in2csv --format=json | \
csvlook
View es-index-differ.py
#!/usr/bin/env python
"""es-index-differ.py
Usage:
es-index-differ.py [options] <host>
Options:
-h --help show this
-v --version show version info
View lights.py
import re
board = [[0 for x in xrange(1000)] for x in xrange(1000)]
on_off = re.compile(r'(toggle|turn on|turn off) ([0-9]+),([0-9]+) through ([0-9]+),([0-9]+)')
def count_on(board):
return sum([sum(row) for row in board])
def toggle(v):
View goodreads.py
#!/usr/bin/env python
"""Grab the books from the current year from goodreads and emit some HTML.
"""
import requests
from xml.dom import minidom
import datetime, time
from email.utils import parsedate
import sys
@slackorama
slackorama / es-fielddata.py
Last active Dec 23, 2015
Output top consumers of Elasticsearch fielddata by each node in a CSV format.
View es-fielddata.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""es-fielddata
Usage:
es-fielddata [options]
Options:
-h --help show this
-v --version show version info
View *text*.txt
export GIT_RADAR_FORMAT="%{$reset_color%} %{$fg[grey]%}git:(%{$reset_color%}%{remote: }%{branch}%{ :local}%{$fg[grey]%})%{$reset_color%}%{ :changes}"
@slackorama
slackorama / gh-starred-pinboard.py
Last active Jan 8, 2019
Make Github starred repos bookmarks in pinboard. I wish IFTTT did this.
View gh-starred-pinboard.py
#!/usr/bin/env python
# send github starred repos to pinboard
# Get the token here:
# https://api.pinboard.in/v1/user/api_token/info
from __future__ import print_function
import sys
View tidybz2.user.js
// ==UserScript==
// @name TidyBZ2
// @namespace http://www.sethmason.com/userscripts
// @description Provide some keyboard shortcuts and clean up the interface for
// bugzilla2 version of bugzilla.
// @include https://*/show_bug.cgi?id=*
// @include https://*process_bug.cgi*
// @author Seth Mason
// @version 0.1
// @license Creative Commons public domain (http://creativecommons.org/licenses/publicdomain/)