Skip to content

Instantly share code, notes, and snippets.

// PhantomJS Cheatsheet
$ brew update && brew install phantomjs // install PhantomJS with brew
phantom.exit();
var page = require('webpage').create();
page.open('http://example.com', function() {});
page.evaluate(function() { return document.title; });
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!-- Generated by RHY @will_awoke -->
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
@rockybean
rockybean / markdownhere.css
Last active January 2, 2017 09:35 — forked from xiaolai/markdownhere.css
markdown-here-css
.markdown-here-wrapper {
font-size: 16px;
line-height: 1.8em;
letter-spacing: 0.1em;
}
pre, code {
font-size: 14px;
font-family: Roboto, 'Courier New', Consolas, Inconsolata, Courier, monospace;
@rockybean
rockybean / removelogo.sh
Created July 2, 2017 11:40 — forked from macfanr/removelogo.sh
remove logo with ffmpeg
#!/bin/sh
if [ $# != 2 ]; then
echo "usage: videoshot.sh /Users/danny/MyVideoDir /Users/danny/MyOutputDir"
exit -1
fi
inputDir=$1
outputDir=$2
binaryEXE=./ffmpeg
@rockybean
rockybean / ingest_pipeline_delay
Created February 27, 2018 22:56 — forked from cdahlqvist/ingest_pipeline_delay
Ingest pipeline definition for measuring ingest delay based on @timestamp field
# Ingest pipeline that records the timestamp the event was processed (`@received`)
# by the ingest pipeline and calculates the difference in milliseconds compared to
# the event timestamp (`@timestamp`).
POST _scripts/calculate_ingest_delay
{
"script": {
"lang": "painless",
"source": "SimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\"); ctx.ingest_delay = (sdf.parse(ctx['received']).getTime() - sdf.parse(ctx['@timestamp']).getTime()) / 1000.0"
}
@rockybean
rockybean / BulkTestDemo.java
Created September 14, 2018 13:35
ES High Level Client Bulk Demo
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.action.bulk.BulkItemResponse;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.index.IndexRequest;
@rockybean
rockybean / ece-cluster-info
Last active January 16, 2019 23:59
ece-clusterinfo.json
{
"cluster_name": "admin-console-elasticsearch",
"associated_apm_clusters": [],
"plan_info": {
"healthy": true,
"current": {
"plan_attempt_id": "15539f8c-6746-40bd-8916-41aefba0fea6",
"attempt_end_time": "2019-01-16T06:26:50.159Z",
"source": {
"user_id": null,
@rockybean
rockybean / ece-zk-log
Last active January 17, 2019 00:54
ece zookeeper log
2019-01-16 13:04:08,419 [myid:12] - WARN [QuorumPeer[myid=12](plain=/0.0.0.0:2193)(secure=disabled):Follower@95] - Exception when following the leader
java.io.EOFException
at java.io.DataInputStream.readInt(DataInputStream.java:392)
at org.apache.jute.BinaryInputArchive.readInt(BinaryInputArchive.java:63)
at org.apache.zookeeper.server.quorum.QuorumPacket.deserialize(QuorumPacket.java:83)
at org.apache.jute.BinaryInputArchive.readRecord(BinaryInputArchive.java:99)
at org.apache.zookeeper.server.quorum.Learner.readPacket(Learner.java:155)
at org.apache.zookeeper.server.quorum.Follower.followLeader(Follower.java:91)
at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:1133)
@rockybean
rockybean / es_node_stats_fs
Created January 22, 2019 15:04
elasticsearch node stats fs
{
"_nodes": {
"total": 3,
"successful": 3,
"failed": 0
},
"cluster_name": "61657d98b1454298aac2fefbb2f00e91",
"nodes": {
"pQdNfyCJQC2lvG5wxmtWig": {
"timestamp": 1548169455122,
@rockybean
rockybean / bulk_rejections.md
Created October 23, 2019 08:58 — forked from cdahlqvist/bulk_rejections.md
rally-bulk-rejections-track

Bulk Rejections Test

This Rally track is used to test the relationship between bulk indexing rejections and the following parameters:

  • Number of concurrent clients indexing into Elasticsearch
  • Number of shards actively being indexed into
  • Number of data nodes in the cluster
  • Size of bulk requests

The track contains a number of challenges, each indexing into an index with a set number of shards using a increasing number of concurrent client connections and two different bulk sizes.