Skip to content

Instantly share code, notes, and snippets.

View victoriadrake's full-sized avatar

Victoria Drake victoriadrake

View GitHub Profile
@victoriadrake
victoriadrake / keygen.sh
Last active December 24, 2021 01:21
Generate ed25519 SSH Key
#!/bin/bash
# Generate the key
ssh-keygen -t ed25519
# Add it to the ssh-agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# Set appropriate permissions
chmod 600 ~/.ssh/id_ed25519
# Show the public key so you can copy it to GitHub
@victoriadrake
victoriadrake / .gitconfig
Last active October 7, 2021 22:24
Code Review Aliases for Git
[alias]
# Adapted from https://blog.jez.io/cli-code-review/
# List files which have changed since BASE
# Set BASE in shell configuration or before the command
files = !git diff --name-only $(git merge-base HEAD \"$BASE\")
# With stat for interactive use
stat = !git diff --stat $(git merge-base HEAD \"$BASE\")
# Put heatmap on your path:
@victoriadrake
victoriadrake / README.md
Created August 4, 2021 12:35
Minimal Machine

Minimal Machine

Quickly set up a new Linux (Debian, Ubuntu based) machine with minimal utilities for general work.

@victoriadrake
victoriadrake / README.md
Created September 6, 2020 20:54
Render full image URLs in your Hugo site with a markup render hook

Render full image URLs in your Hugo site

This is a markup render hook for Hugo sites to change the behavior of image links in your built site. It should live at layouts/_default/_markup/render-image.html.

If the image link begins with http, the link will be rendered as-is.

If not, the page permalink will prefix the image URL to produce the full path to the image in the rendered site page.

@victoriadrake
victoriadrake / outrun.py
Last active July 19, 2020 15:42
🎠 Theme for powerline-shell
from powerline_shell.themes.default import DefaultColor
dark0 = 235
dark1 = 237
dark2 = 239
dark3 = 241
dark4 = 243
light0 = 229
light1 = 223
```python
# Create the Checker class
class Checker:
# Queue of links to be checked
TO_PROCESS = Queue()
# Maximum workers to run
THREADS = 100
# Maximum seconds to wait for HTTP response
TIMEOUT = 60
@victoriadrake
victoriadrake / latency-numbers.md
Created February 28, 2020 17:00
Peter Norvig‘s Latency Numbers
Task Time
CPU execute typical instruction 1/1,000,000,000 sec = 1 nanosec
CPU fetch from L1 cache memory 0.5 nanosec
CPU branch misprediction 5 nanosec
CPU fetch from L2 cache memory 7 nanosec
RAM Mutex lock/unlock 25 nanosec
RAM fetch from main memory 100 nanosec
Network send 2K bytes over 1Gbps network 20,000 nanosec
RAM read 1MB sequentially from memory 250,000 nanosec
@victoriadrake
victoriadrake / commit-message-icons.txt
Last active May 22, 2021 13:54
Some opinionated emojis for iconizing commit messages.
🐣 Initial commit
📜 Add LICENSE
🖍 Minor edit
🔧 Fix *
🌱 Add *
# Look in the public/ directory
find public/ \
# Ignore directories called "static" regardless of location
-not -path "*/static/*" \
# Print the file paths of all files ending with any of these extensions
\( -name '*.png' -o -name '*.jpg' -o -name '*.jpeg' \) -print0 \
# Pipe the file paths to xargs and use 8 parallel workers to process 2 arguments
| xargs -0 -P8 -n2 \
# Tell mogrify to strip metadata, and...
mogrify -strip \
.POSIX:
DESTDIR=public
HUGO_VERSION=0.58.3
OPTIMIZE = find $(DESTDIR) -not -path "*/static/*" \( -name '*.png' -o -name '*.jpg' -o -name '*.jpeg' \) -print0 | \
xargs -0 -P8 -n2 mogrify -strip -thumbnail '1000>'
.PHONY: all
all: get_repository clean get build test deploy