Skip to content

Instantly share code, notes, and snippets.

View pmarreck's full-sized avatar

Peter Marreck pmarreck

  • formerly desk.com, thredup.com and lifebooker.com. currently Director of Engineering @addigence
  • Long Island, NY
  • 06:50 (UTC -04:00)
View GitHub Profile
@pmarreck
pmarreck / random_taoup_quote_awk_assistance.md
Created May 8, 2023 18:44
ChatGPT4 helps with `awk` script to alter output of `taoup` to get a single categorized quote

AWK Script for Quotes

You

I have a text file with a list of quotes (example excerpt below). Some of the lines are header lines for the section of quotes following, which begin with 3 or more hyphens. I want an awk script that selects a random non-header line, determines its header (the nearest line above it that starts with 3 or more hyphens), and then outputs the header and the line.

---- Characteristics of Innovative People ----
Iterate between abstract and concrete thinking.
Acknowledge the limits of your knowledge.
Step out of your comfort zone.
@pmarreck
pmarreck / shell_types_explained.md
Created May 3, 2023 14:42
Linux Shell and Login Types (and relevant configs read) Explained by ChatGPT-4

Shell Types Explained

You

In a Linux and shell context, what is the difference between a "login shell", an "interactive shell" and any other kind of logged-in mode?

ChatGPT

In the context of Linux and shell, there are several types of shells that can be opened, including login shells, interactive shells, and non-interactive shells. Here's a brief explanation of these types:

  1. Login Shell: A login shell is the first shell that is run when you log into a Unix-based system. This shell reads your profile file (like ~/.bash_profile, ~/.bash_login, or ~/.profile) to set environment variables and settings. A login shell typically ends with a shell prompt for user input.
  2. Interactive Shell: An interactive shell is a shell session that is ready to take commands from the user. It's "interactive" because it interacts directly with the user. Both login shells and non-login shells can be interactive. In an interactive shell, command history is kept, and the shell reads and executes the ~/.bashrc file upon
@pmarreck
pmarreck / nix_flakes_explanation_chatgpt4.md
Created April 28, 2023 20:06
Explanation of Nix/Nix Flakes to someone who is unfamiliar with them, courtesy of ChatGPT-4

Nix Flakes Explained

You

explain nix flakes to me like I'm a software developer but new to Nix.

Then explain the difference between "old Nix/NixOS" and Nix Flakes to me.

ChatGPT

Part 1: Introduction to Nix Flakes

@pmarreck
pmarreck / configure_steam_for_many_cores.bash
Created April 28, 2023 14:15
How to make the fossilize_replay Steam processes (which precompile shaders on Linux) use all your cores
# Adjust the core count (or just use nproc) and location to your hardware and steam install location
# This will create the file if it doesn't exist yet
# From: https://www.reddit.com/r/linux_gaming/comments/prsceh/is_there_a_way_to_get_valves_fossilize_replay/hdqfayv/
echo "unShaderBackgroundProcessingThreads $(nproc)" >> ~/.local/share/Steam/steam_dev.cfg
@pmarreck
pmarreck / rule_30.bash
Created April 26, 2023 03:11
Stephen Wolfram's Rule 30 output in Bash, generated (mostly) via ChatGPT4
#!/usr/bin/env bash
# Get the terminal width
width=$(tput cols)
# Set number of output lines
LINES=${LINES:-10000}
# Initialize the first row with a single block character in the middle
row=$(printf "%-$((width / 2))s" " ")
@pmarreck
pmarreck / animated_analog_SVG_clock.svg
Created April 25, 2023 15:35
Animated analog SVG clock, JS-powered
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pmarreck
pmarreck / pmarreck_resume.md
Last active May 17, 2023 19:59
Peter Marreck Resume 2023

Peter R. Marreck

Port Washington, NY 11050
203.570.4096
peter@marreck.com

Education

Cornell University, Ithaca, New York
B.A. Psychology, Computer Science (minor)

@pmarreck
pmarreck / gpt4_is_also_a_zfs_expert.md
Last active April 7, 2023 19:09
Wherein ChatGPT4 acts as an experienced ZFS systems admin and makes recommendations to my config

ZFS Admin: Collect, Configure.

You:

I want you to act as an expert systems administrator specializing in ZFS filesystems. I want you to give me commands to run to collect information about my ZFS drives and configuration, and I will paste the output back to you, and you will then make configuration recommendations (possibly including the commands to run) to increase performance given my use case and priorities (which you can also ask me anything about).

ChatGPT:

Great, I'll be happy to help you with your ZFS configuration. Let's start by gathering some basic information about your current ZFS setup.

Please run the following commands and provide me with the output:

@pmarreck
pmarreck / git_commit_ai_reviewed_by_ai.md
Last active April 7, 2023 18:59
chatgpt4 making good edits to my bash function

Generate Git commit message.

You:

I wrote the following Bash function to use the OpenAI API to automatically come up with a git commit message and put it on the clipboard. Do you have any constructive criticisms or suggestions to make it better?

Here is the entire Bash file contents:

#!/usr/bin/env bash

git_commit_ai() {
@pmarreck
pmarreck / von_neumann_nuke_first.md
Created March 31, 2023 18:53
John von Neumann and his game-theory-based argument for a nuclear first strike: An analysis with GPT-4

Nuclear First Strike Controversy

You:

Did John von Neumann really advocate for a nuclear first strike using game theory to argue for it? Was his game theory argument valid, or did it have flaws?

ChatGPT:

John von Neumann, a brilliant mathematician and one of the founding figures of game theory, was known for his work on the strategic aspects of nuclear war. During the early years of the Cold War, he advocated for a strong deterrence policy against the Soviet Union, including the possibility of a nuclear first strike. However, it's important to note that von Neumann's views on this issue were complex and evolved over time.

Von Neumann's game theory argument for a nuclear first strike was based on the concept of minimax, which suggests that players in a game should minimize their maximum possible loss. In the context of a nuclear conflict between the United States and the Soviet Union, von Neumann believed that a preemptive strike would minimize the potential damage to the United States by elimin