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
@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:50470f7de18b432b12116617448ce2d1
Created December 18, 2017 02:43 — forked from human39/gist:8b80d51a75c99e64eb42
Logstash split field solution.
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".
@geekpete
geekpete / Gemfile
Created October 6, 2016 06:33 — forked from jsvd/README.md
logstash grok filter benchmark script
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"
@geekpete
geekpete / GIF-Screencast-OSX.md
Created October 5, 2016 23:49 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: