Skip to content

Instantly share code, notes, and snippets.

@hackerb9
hackerb9 / ttest.bc
Last active June 27, 2019 12:32
Example of performing Student's t-test using the GNU bc calculator. The heart of this is just the short function at the beginning, the rest is there to make using it easier. (For example, there's a t-table builtin to tell you if the means are significantly different.)
/* Student's t-test (Two Independent Samples) */ /* -*- c -*- */
/* Implemented in GNU bc by hackerb9, 2018. */
/* Copyright assigned to FSF. */
/*
*
* µ₀ - µ₁
* t = ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
* ⎡ ⎤ ½
* ⎢ (ΣA² - (ΣA)²/n₀) + (ΣB² - (ΣB)²/n₁) ⎛ 1 1 ⎞ ⎥
@hackerb9
hackerb9 / gist:dfce5c08f358697240c24867491d1776
Created August 30, 2018 11:46
Sum of Factors (brainteaser)
#!/usr/bin/python3
# Sum of Factors. hackerb9 2018.
# This is a generalization of a certain type of numeric logic puzzle
# that gives you a hint by telling you that the previous hints were
# insufficient: that is, you now know that the answer is one that
# could be arrived at two different ways. Here's an example, as told
# by Jim Fixx in the 1970's:
############################################
@hackerb9
hackerb9 / iptables-redirect.conf
Created August 11, 2019 16:50
/etc/fail2ban/action.d/iptables-redirect.conf: After login failures, redirect to a different port. Handy for sending attackers to your honeypot
# Fail2Ban configuration file
#
# Redirect from a certain port to a different port on the same host
# Example usage:
# # By default redirects port=22, toport=2222, protocol=tcp
# action = iptables-redirect[name=cowrie]
#
# # Can specify other defaults if you'd like.
# action = iptables-redirect[name=web, proto=tcp, port=80, toport=8080]
@hackerb9
hackerb9 / lookup.py
Last active November 4, 2019 07:14
Simplest example of parsing text files of ITIS taxonomy
#!/usr/bin/python3
# globals
name={}
hierarchy={}
vernacular={}
synonyms={}
def loaddb():
"Load up databases into dictionaries: name, hierarchy, vernacular"
@hackerb9
hackerb9 / gitfixssh
Created August 20, 2021 05:34
Fix existing github repository to use ssh access instead of username/password
#!/bin/bash
# A temporary script for a temporary problem.
# I have a bunch of github repositories that no longer work
# for git push because the original URL uses the deprecated
# username/password combo. This script repairs the remote
# origin so it uses ssh.
# B9 August 2021
@hackerb9
hackerb9 / IBM5100-NYT-1975-Sept-10.png
Last active August 20, 2021 20:36
Screenshot from New York Times, September 10, 1975, page 75 (via "Times Machine")
IBM5100-NYT-1975-Sept-10.png
@hackerb9
hackerb9 / NotoColorEmoji.ttf
Last active September 30, 2021 23:17
Debian's NotoColorEmoji.ttf from September 2020
This file has been truncated, but you can view the full file.
@hackerb9
hackerb9 / Arthritis fishing.md
Last active May 21, 2022 19:53
Tips on making fishing easier for people with arthritis

From fishing forum:

Hirdy Well-known member Jan 26, 2017 #12 G'day Denny,

Although I don't personally have arthritis, I can empathise fully with you. My wife has had it in her hands since she was a teenager.

@hackerb9
hackerb9 / Raven.md
Last active July 25, 2022 16:52
Raven todo

Now that I have a phone running GrapheneOS (GOS), here are some of the things that need doing.

  • import phone book

  • install/replace missing apps

    • text editor
    • calendar
    • email
  • jitsi (web app works)