Skip to content

Instantly share code, notes, and snippets.

View geekpete's full-sized avatar
💭
Equilibrious

Peter Dyson geekpete

💭
Equilibrious
View GitHub Profile
@geekpete
geekpete / markdown-details-collapsible.md
Last active January 19, 2023 06:50 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

How to

<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
@geekpete
geekpete / gist:72c46971322e49ffa09d1edcf2daafc8
Created October 29, 2020 02:53 — forked from Khoulaiz/gist:41b387883a208d6e914b
Checking ports without telnet

Here are several different ways to test a TCP port without telnet.

$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C

$ cat &lt; /dev/tcp/127.0.0.1/23
### Keybase proof
I hereby claim:
* I am geekpete on github.
* I am elasticpete (https://keybase.io/elasticpete) on keybase.
* I have a public key ASCr8O5h-mFrsjr7Crb14OyPzjFqrV8XXsrx_OaAkVlY2wo
To claim this, I am signing this object:
@geekpete
geekpete / terms agg repro 6.8.md
Last active April 20, 2020 04:49
Trying to repro the docs example for Terms agg doc counts being approximate

NB, the shard numbers that the batches hash to are different in 6.8, but each batch still goes to separate shards. 6.8 results in the same result as 7.x attempts.

DELETE /test-term-agg
PUT /test-term-agg
{
  "settings": {
    "number_of_shards": 3
  },
@geekpete
geekpete / restic_files.txt
Created April 26, 2019 10:50 — forked from amarendra/restic_files.txt
Restic backup setup
### 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
@geekpete
geekpete / display-switcher.sh
Created April 14, 2019 22:30 — forked from gservat/display-switcher.sh
Display profile switcher using nvidia-settings
#!/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}
@geekpete
geekpete / UNICODE to ASCII python replace
Created March 26, 2019 02:41 — forked from tushortz/UNICODE to ASCII python replace
Function to replace some annoying 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', '-').
@geekpete
geekpete / bmf25.py
Created March 25, 2019 04:18 — forked from marcelcaraciolo/bmf25.py
bm25f
# 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))))
@geekpete
geekpete / zoom.md
Created March 10, 2019 22:48 — forked from jordansissel/zoom.md
Zoom on Linux notes

In a zoom?

xdotool search --name "Zoom Meeting ID:"

This will exit non-zero if no meeting matching this name is found. "Zoom Meeting ID:"

This window exists regardless of sharing or not sharing, in my tests.

@geekpete
geekpete / gist:3af4b6789292dc1ce60a9812731ed99e
Last active June 14, 2018 01:31
multimatch across two indices
DELETE /index1,index2/
POST /index1/doc
{
"field1": "dog"
}
POST /index2/doc
{
"field2": "cat"
}