Skip to content

Instantly share code, notes, and snippets.

View lucasmodrich's full-sized avatar
:octocat:
Focusing

LM lucasmodrich

:octocat:
Focusing
  • Australia
  • 02:50 (UTC +10:00)
View GitHub Profile
@ThomasFrans
ThomasFrans / git-worktree.md
Last active March 21, 2025 03:25
A gentle introduction to Git worktree

A Gentle Introduction to Git Worktree

Git worktree has become a major part of how I use Git over the past year. Anytime I mention it somewhere however, I get reactions from people who have never heard about the feature. Others have heard about it, but don't know how exactly it works or why it's beneficial. That's why I decided to write a short tutorial/introduction on this awesome feature that is baked right into the very git you are already using. I hope this can help people discover worktrees and be a gentle introduction on how to get started using them.

What is Git worktree

Git worktree facilitates working with multiple branches. In a normal Git workflow, you can only ever have one branch checked out at a single time.

@duncansmart
duncansmart / Secure environment variables on windows.md
Last active January 7, 2025 04:01
Secure environment variables on windows

Encrypting

To create a DPAPI-encrypted environment variable run the following PowerShell:

[Environment]::SetEnvironmentVariable((Read-Host "Enter name"), (Read-Host "Enter value" -AsSecureString | ConvertFrom-SecureString), 'User')

And follow the prompts:

image

@dannberg
dannberg / obsidian-daily-note-template.txt
Last active May 12, 2025 10:23
Dann Berg's Daily Note Template for Obsidian. Uses Dataview & Templater plugins. Should be saved as a Markdown file in Obsidian. Read the full tour: https://dannb.org/blog/2022/obsidian-daily-note-template/
---
created: <% tp.file.creation_date() %>
---
tags:: [[+Daily Notes]]
# <% moment(tp.file.title,'YYYY-MM-DD').format("dddd, MMMM DD, YYYY") %>
<< [[Timestamps/<% tp.date.now("YYYY", -1) %>/<% tp.date.now("MM-MMMM", -1) %>/<% tp.date.now("YYYY-MM-DD-dddd", -1) %>|Yesterday]] | [[Timestamps/<% tp.date.now("YYYY", 1) %>/<% tp.date.now("MM-MMMM", 1) %>/<% tp.date.now("YYYY-MM-DD-dddd", 1) %>|Tomorrow]] >>
---
@dungsaga
dungsaga / reduce-size-of-a-WSL-virtual-disk.md
Last active April 17, 2025 04:35
reduce size of a WSL virtual disk

Reduce size with diskpart

You should run PowerShell as Administrator (otherwise diskpart won't be able to received the piped commands)

$vhdx_path = '%USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\ext4.vhdx'

@"
select vdisk file=$vhdx_path
compact vdisk
@mavaddat
mavaddat / .bashrc
Last active April 15, 2025 04:33 — forked from glsorre/keychain.ps1
Windows git and Windows Subsystem for Linux will never prompt ssh passphrase again
# To avoid having to re-type the password for SSH
test -f /usr/bin/keychain && eval $(/usr/bin/keychain --eval --quiet id_rsa)
@jlollis
jlollis / README.md
Created May 3, 2021 17:32 — forked from AlinaNova21/README.md
Rancher 2.0, RKE, and some Raspberry Pi 3s

Kubernetes and Arm

Getting rke and Rancher setup to run kubernetes on arm is interesting. There is no official support yet via rancher, although there is interest and some work done towards those efforts. This is my attempt at getting a cluster of 3 Pis (2 3Bs and 1 3B+) provisioned and registered to a rancher 2 server.

Prep

I've successfully completed this both with Hypriot OS 1.9.0 and the arm64 builds https://github.com/DieterReuter/image-builder-rpi64 Both times I used the same basic cloud-init setup

@tomtom215
tomtom215 / docker-compose.yaml
Last active January 9, 2024 02:29
adguard+portainer+watchtower docker-compose raspberry pi4
version: '3.3'
services:
portainer:
container_name: portainer
restart: unless-stopped
ports:
- '9000:9000'
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
- /home/pi/docker/portainer:/data
@WillPresley
WillPresley / wsl-backup-and-compress.ps1
Last active April 17, 2025 04:33
Backup WSL2 Virtual Disks and Compress with 7-Zip
# Backup WSL2 virtual disks using native functions and compress them using 7zip
## Will Presley, 2020
## willpresley.com
#### http://mats.gardstad.se/matscodemix/2009/02/05/calling-7-zip-from-powershell/
# Alias for 7-zip
if (-not (test-path "$env:ProgramFiles\7-Zip\7z.exe")) {throw "$env:ProgramFiles\7-Zip\7z.exe needed"}
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
#### Alternative native PS 7-zip: https://www.sans.org/blog/powershell-7-zip-module-versus-compress-archive-with-encryption/
@mattetti
mattetti / newWindowsMachine.sh
Last active November 13, 2024 00:27
bash script to run from WSL to setup Windows and Linux from the linux side. To run: `wget https://gist.githubusercontent.com/mattetti/9807e2a1e654a7c00bb9c13f340fc39f/raw/ -O newMachineSetup.sh` and then `bash newMachineSetup.sh`
#!/bin/bash
export WINHOME=$(wslpath "$(wslvar USERPROFILE)")
# github username is needed to pull down the dot files
export GITHUBUSERNAME="mattetti"
# wininstall does an install using winget and checks that it went well
function wininstall {
echo "Installing $1";
cmd.exe /C winget.exe install -e $1;
@dornfeder
dornfeder / Readme.md
Last active January 24, 2024 09:38
Git Branching Diagram Template

Git Branching Diagram Template for diagrams.net

This is my own variant of a git branching diagram template based on Bryan Braun's great template.

You can use this diagram as a template to create your own git branching diagrams. Here's how:

  1. Create a new diagram with diagrams.net (formerly draw.io)
  2. Go to File > Open From > URL
  3. Insert this url (it points to the xml data below): https://gist.githubusercontent.com/dornfeder/13abff279de357f048e474d4ed6c692d/raw/f5efc838bd34429e59e38063bd348b7a86457d18/git-diagram-template.xml
  4. Customize as needed for your team.