Skip to content

Instantly share code, notes, and snippets.

View geoffmyers's full-sized avatar

Geoff Myers geoffmyers

View GitHub Profile

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@geoffmyers
geoffmyers / id_rsa_encryption.md
Created May 15, 2025 18:05 — forked from fcoury/id_rsa_encryption.md
Encrypt/Decrypt a File using your SSH Public/Private Key on Mac OS X

A Guide to Encrypting Files with Mac OS X

This guide will demonstrate the steps required to encrypt and decrypt files using OpenSSL on Mac OS X. The working assumption is that by demonstrating how to encrypt a file with your own public key, you'll also be able to encrypt a file you plan to send to somebody else using their private key, though you may wish to use this approach to keep archived data safe from prying eyes.

Too Long, Didn't Read

Assuming you've already done the setup described later in this document, that id_rsa.pub.pcks8 is the public key you want to use, that id_rsa is the private key the recipient will use, and secret.txt is the data you want to transmit…

Encrypting

$ openssl rand 192 -out key

$ openssl aes-256-cbc -in secret.txt -out secret.txt.enc -pass file:key

@geoffmyers
geoffmyers / crossover-howtocompile.md
Created November 23, 2024 13:56 — forked from sarimarton/crossover-howtocompile.md
CodeWeavers CrossOver - How to compile from source! for macOS

UPDATE 2023-01-22 21:34:33

This guide was last tested on an Intel MacBook 2017. Since then it's unmaintained and won't be updated (I quit the game and bought a life-time crossover licence).


This has been forked from https://gist.github.com/Alex4386/4cce275760367e9f5e90e2553d655309

For the latest discussion, see the comments there.

@geoffmyers
geoffmyers / css-units-best-practices.md
Created February 7, 2023 14:59 — forked from basham/css-units-best-practices.md
CSS Units Best Practices

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units

@geoffmyers
geoffmyers / liquidctl.2s.sh
Last active March 29, 2021 18:46
Liquidctl BitBar Plugin
#!/usr/local/bin/zsh
LIQUIDCTL="/usr/local/bin/liquidctl"
STATUS=$($LIQUIDCTL status)
LIQUID_TEMP=$(echo $STATUS | grep "Liquid temperature" | egrep -o "[0-9]{2,3}")
FAN_RPM=$(echo $STATUS | grep "Fan speed" | egrep -o "[0-9]{3,4}")
PUMP_RPM=$(echo $STATUS | grep "Pump speed" | egrep -o "[0-9]{3,4}")
if [[ "$1" = "color" ]]; then
if [[ "$4" ]]; then
@geoffmyers
geoffmyers / default-apps.duti
Last active April 10, 2019 18:41
Default Handlers for Extensions and Protocols
# **************************************************
# Default Handlers for Extensions and Protocols
# Last Updated by Geoff Myers on June 28, 2018
# **************************************************
# **************************************************
# Extensions - Default Handlers
# **************************************************
# Apple Archive Utility
@geoffmyers
geoffmyers / cloudflare-ddns.sh
Last active October 8, 2017 02:53
Cloudflare Dynamic DNS Simple Update Script
#!/usr/local/bin/zsh
IP_ADDRESS=$(curl ipecho.net/plain ; echo)
curl -X PUT "https://api.cloudflare.com/client/v4/zones/{zone_identifier}/dns_records/{identifier}" \
-H "X-Auth-Email: {cloudflare_email_address}" \
-H "X-Auth-Key: {cloudflare_api_key}" \
-H "Content-Type: application/json" \
--data "{\"type\":\"A\",\"name\":\"{domain_name}\",\"content\":\"$IP_ADDRESS\"}"