Skip to content

Instantly share code, notes, and snippets.

View emmahsax's full-sized avatar

Emma Sax emmahsax

View GitHub Profile

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.

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 (
@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 / 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 / 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 / bootstrap-navbar.md
Last active July 5, 2022 04:07
Example of a simple navigation with Bootstrap 5

Navbar with Bootstrap 5

Here's the html file. This file assumes that there's two SVG icons (an X and a menu bar) downloaded in the /assets/images/icons directory:

<header class="sticky-top">
  <nav class="navbar navbar-expand-md navbar-dark py-0 py-md-0">
    <div class="container-fluid">
      <!-- Left hand side of navbar -->
      <a class="navbar-brand mb-0" href="/" target="_self">
@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 / github-pages-deploy-with-travis.md
Last active September 29, 2021 18:14
Example .travis.yml file to deploy to GitHub Pages

Example .travis.yml file to deploy to a GitHub Pages branch

os: linux
language: ruby
cache: bundler
install: bundle install

branches:
  only:
@emmahsax
emmahsax / installing-old-brew-formulas.md
Last active September 14, 2021 22:27
Instructions to install an outdated Homebrew formula

Installing Old Homebrew Formulas

Over the past several years, Homebrew has made it continually difficult to install an outdated formula. I'm not quite sure why, but it's been a struggle for developers for the past 7+ years.

However, there is a workaround (however it's not straight-forward). For this example, I'll use ruby-build:

  1. Note the version you currently have installed:
$ ruby-build --version
ruby-build 20210825
@emmahsax
emmahsax / merging-forks-with-upstream.md
Last active February 10, 2023 15:39
How to merge forks back in with upstream

Merging Forks with Upstream

Check to see if there's changes in upstream that you need to make in your fork

Look for a message like this. If it says that your default branch is behind the upstream's default branch (usually master), it means there are updates:

image

If there are updates, then merge your local fork with upstream