<details>
<summary>see this long example - click to expand </summary>
You can use regular markdown formatting inside your collapsed section.
### Heading
1. Foo
2. Bar
Here are several different ways to test a TCP port without telnet.
BASH (man page)
$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C
$ cat < /dev/tcp/127.0.0.1/23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### this is how file .restic.env is | |
export RESTIC_REPOSITORY="b2:XXXXXXX:YYYYYY" | |
export B2_ACCOUNT_ID="<a/c id>" | |
export B2_ACCOUNT_KEY="<a/c key" | |
export RESTIC_PASSWORD_FILE="$HOME/<a dropbox folder>/restic.pwd" | |
export RESTIC_INCLUDE_FILE="$HOME/<a dropbox folder>/restic.include" | |
export RESTIC_EXCLUDE_FILE="$HOME/<a dropbox folder>/restic.exclude" | |
export RESTIC_LOG_DIR="$HOME/.restic/log/" | |
### file: restic.pwd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
exec > >(tee -a "/tmp/display-switcher.log") 2>&1 | |
# NOTE: This requires GNU getopt. On Mac OS X and FreeBSD, you have to install this | |
# separately; see below. | |
usage() { | |
cat << HELP >&2 | |
Usage: $0 [option ...] {profile} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def unicodetoascii(text): | |
TEXT = (text. | |
replace('\\xe2\\x80\\x99', "'"). | |
replace('\\xc3\\xa9', 'e'). | |
replace('\\xe2\\x80\\x90', '-'). | |
replace('\\xe2\\x80\\x91', '-'). | |
replace('\\xe2\\x80\\x92', '-'). | |
replace('\\xe2\\x80\\x93', '-'). | |
replace('\\xe2\\x80\\x94', '-'). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BM25F Model | |
def bm25(idf, tf, fl, avgfl, B, K1): | |
# idf - inverse document frequency | |
# tf - term frequency in the current document | |
# fl - field length in the current document | |
# avgfl - average field length across documents in collection | |
# B, K1 - free paramters | |
return idf * ((tf * (K1 + 1)) / (tf + K1 * (1 - B + B * (fl / avgfl)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Problem: We have a log line that includes a perl class that we want to log the class | |
and method in their respected fields. An example class and method in perl: | |
Animal::Dog::bark | |
In this example, "bark" is the method. "Animal::Dog" is the class. | |
After some searching and hacking, I found a solution that works with Logstash 1.4.2 | |
Assume the input is "Animal::Dog::bark". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
# Specify your gem's dependencies in logstash-mass_effect.gemspec | |
gem "logstash-core", :path => "./logstash/logstash-core" | |
gem "logstash-core-event-java", :path => "./logstash/logstash-core-event-java" | |
gem "logstash-core-plugin-api", :path => "./logstash/logstash-core-plugin-api" | |
gem "logstash-filter-grok", :path => "./logstash-filter-grok" | |
gem "logstash-patterns-core", :path => "./logstash-patterns-core" | |
gem "benchmark-ips" |
NewerOlder