Skip to content

Instantly share code, notes, and snippets.

View emmahsax's full-sized avatar

Emma Sax emmahsax

View GitHub Profile
@emmahsax
emmahsax / static-site-urls-and-links.md
Last active March 5, 2025 16:38
Linking to images, resources, CSS, and JS within Jekyll

Memory Sizes

Common Name (decimal system) Decimal Value (bytes) Binary System Equivalent Binary Value (bytes) Equal To (binary) Description
Bit 1/8 Bit 1/8 1/8 Byte Every individual binary digit (0 and 1)
Nibble 1/2 Nibble 1/2 4 Bits or 1/2 Byte Combination of four bits of binary digits or half of an octet – can be represented by a single hexadecimal digit
Byte 1 Byte 1 8 Bits A unit of data that is eight binary digits long, and can be represented using a letter, number, or character (e.g. "h", "7", or "$")
Kilobyte (KB) 1,000 (103) Kibibyte (KiB) 1,024 (210) 1,024 Bytes Often used to measure the size of small files
Megabyte (MB) 1,000,000 (106) Mebibyte (MiB) 1,048,576 (220) 1,024 KB Often used to measure the size of large files
Gigabyte (

Common File Permissions

Permission Code Used For... Example Owner Group Public
755 Executable bin/bash_script.sh Read, Write, Execute Read, Execute Read, Execute
644 Standard read/write README.md Read, Write Read Read
600 Private Read-only ~/.ssh/id_ed25519 Read, Write N/A N/A

See more at Chmod Calculator.

@emmahsax
emmahsax / turn-seconds-into-human-readable-time.md
Last active March 16, 2024 18:47
Easily turn seconds into a human-readable time in Ruby

Turn Seconds into Human-Readable Time with Ruby

If you have an integer which is an amount of seconds, you can easily turn it into the form

X days, Y hours, Z minutes, Q seconds

Here's a little method that will do all of that!

@emmahsax
emmahsax / simple-k8s-pod.md
Last active March 12, 2024 17:47
A very simple Kubernetes pod

A simple Kubernetes pod

Apply this pod to a Kubernetes cluster:

kubectl apply -f simple_pod.yaml

This pod will be applied to the default namespace.

@emmahsax
emmahsax / photoswipe-and-lightbox2.md
Last active February 14, 2024 02:18
How to offer both PhotoSwipe v5 and Lightbox2 in a Jekyll project

Offering both PhotoSwipe v5 and Lightbox2 in a static site

This documents an example of how to offer both PhotoSwipe v5 and Lightbox2 in one project.

Notes

PhotoSwipe

PhotoSwipe helps to make the photo clickable, and then it'll zoom for the user and create a gallery, you can call the photo _include:

@emmahsax
emmahsax / -pluralize.md
Last active January 11, 2024 20:01
Pluralizing English words according to all pluralizing rules!

Easily Pluralizing English Words in Go

This code makes it easy to pluralize words based off of English pluralizing rules.

$ go run main.go
2 balls
1 boy
3 foxes
2 babies
@emmahsax
emmahsax / git-aliases.md
Last active August 13, 2023 22:10
Personal git aliases

Personal Git Aliases

A list of git aliases I use on my machines to make working with GitHub and GitLab a little bit faster.

For more information, see my Ruby command-line gem: emmahsax/git_helper.

alias gadd='git add -A'
alias gaddp='git add -p'
alias gcam='git commit -am'
@emmahsax
emmahsax / totp.md
Last active August 10, 2023 18:49
A helpful file that shows how to generate TOTP rotating codes using Ruby

Generating TOTP tokens from a seeds file on your machine in Ruby

This file assumes you have a file (~/.totp.yml) on your machine where you store the SERVICEs, and their secret keys:

aws: rAndOmCharaCTeRsHerE
google: rAndOmCharaCTeRsHerE

Then, you can call like this:

@emmahsax
emmahsax / circleci-config-to-ignore-branch.md
Last active June 15, 2023 11:41
CircleCI configuration to completely ignore a specific branch

CircleCI Configuration to Ignore a Branch

This file live in the .circleci/ directory of your project, named config.yml:

version: 2.1
jobs:
  skip:
    working_directory: ~/PROJECT_DIRECTORY # If we leave this out, the build will break with missing required arguments
 docker: [ image: circleci/ruby:2.6.5 ] # This doesn't really matter, but just choose any docker image