Skip to content

Instantly share code, notes, and snippets.

View bhpayne's full-sized avatar
💭
wandering in the wilderness

Ben bhpayne

💭
wandering in the wilderness
View GitHub Profile
$ time python loop_with_delay.py
index = 0
index = 1
index = 2

real    0m6.202s
user    0m0.111s
sys     0m0.039s
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<thisdocument>
<process userobjective="turn on the computer">
<!-- https://www.quora.com/How-does-a-power-button-work-in-a-computer -->
<!-- https://wiki.osdev.org/System_Initialization_(x86) -->
<!-- https://wiki.osdev.org/System_Initialization_(x86) -->
<task entity="user" action="push power button">
<task entity="power button" action="electrical current running through wire is interrupted"></task>
<task entity="electrical wire" action="current goes to zero for short duration"></task>
<task entity="mother board" action="?"></task>
# thanks to https://dreampuf.github.io/GraphvizOnline
digraph G {
label="how to browse the internet"
labelloc = "t"; // place the label at the top (b seems to be default)
#concentrate=true; # edge overlap # https://stackoverflow.com/a/4671508/1164295
#overlap=false; # no effect
compound=true; # as per https://stackoverflow.com/a/2012106/1164295
# ovals are intended to be tangible activites;
#!/usr/bin/env python3
"""
runs via crontab on a DigitalOcean VPS
the sendgrid API key is in a ".env" file
"""
# how to run this script:
# python3 hacker_news_rss_email_alerts.py
#!/usr/bin/env python3
"""
The arXiv RSS (https://arxiv.org/help/rss) is separate from
the arXiv API (https://arxiv.org/help/api/index)
The API supports /query
The RSS provides XML for a given topic
https://arxiv.org/help/robots
#!/usr/bin/env python
from datetime import datetime
import os
"""
Much of the typical professional communication follows a script.
Therefore, we can use a script to generate the content.
This script implements a decision tree that gets presented
to the user as a sequence of prompts. The output of the
@bhpayne
bhpayne / markup_options.md
Last active April 18, 2021 14:52
survey of various markdown/markup formats

Criterion for inclusion: human readable. (which excludes ProtoBuf)

a key / value format where keys can (optionally) be grouped into sections.
cite

; last modified 1 April 2001 by John Doe
[owner]

For a great comparison, see https://tin6150.github.io/psg/blogger_container_hpc.html

Docker

privileged user running support daemon

Docker images are comprised of multiple layers managed by the Docker system

The docker daemon making calls to containerd, which in turn calls runc.

  • containerd is the new high-level daemon for image management
@bhpayne
bhpayne / Dockerfile
Last active May 8, 2021 18:56
concurrent pathos password search
FROM centos:7
RUN yum install -y \
python3-devel
RUN pip3 install setuptools_rust && \
pip3 install cryptography==3.2 && \
pip3 install msoffcrypto-tool
RUN pip3 install pathos
@bhpayne
bhpayne / delete_large_file.md
Created June 14, 2021 16:09
fake git history for testing file deletion

Following command edits the bare repo (rather than a clone of the repo)

cd bare_git_repo
git filter-branch --prune-empty -d /Users/username/software/git_test/git_backup --index-filter "git rm --cached -f --ignore-unmatch a_large_binary" --tag-name-filter cat -- --all

Then run the following on the bare repo

git update-ref -d refs/original/refs/heads/master
git reflog expire --expire=now --all
git gc --prune=now