Skip to content

Instantly share code, notes, and snippets.

View stoffeastrom's full-sized avatar

Christoffer Åström stoffeastrom

View GitHub Profile
@stoffeastrom
stoffeastrom / git-stash-untracked-show.md
Created December 22, 2020 22:02 — forked from imghasemi/git-stash-untracked-show.md
How to show git stash untracked files

REF: https://stackoverflow.com/a/12681856

Untracked files are stored in the third parent of a stash commit. (This isn't actually documented, but is pretty obvious from The commit which introduced the -u feature, 787513..., and the way the rest of the documentation for git-stash phrases things... or just by doing git log --graph stash@{0})

You can view just the "untracked" portion of the stash via:

git show stash@{0}^3
@stoffeastrom
stoffeastrom / hoge.rb
Created June 21, 2021 18:08 — forked from minamijoyo/hoge.rb
Using GitHubPrivateRepositoryReleaseDownloadStrategy removed in brew v2
require "formula"
require_relative "lib/private_strategy"
class Hoge < Formula
homepage "https://github.com/yourcompany/hoge"
url "https://github.com/yourcompany/hoge/releases/download/v0.1.0/hoge_v0.1.0_darwin_amd64.tar.gz", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
sha256 "6de411ff3e4b1658a413dd6181fcXXXXXXXXXXXXXXXXXXXX"
head "https://github.com/yourcompany/hoge.git"
version "0.1.0"
@stoffeastrom
stoffeastrom / EBNF-cheatsheet.md
Created May 21, 2022 12:22 — forked from refs/EBNF-cheatsheet.md
Extended Backus-Naur Form Cheatsheet

Symbols

Usage Notation
definition =
concatenation ,
termination ;
alternation |
optional [ ... ]
repetition { ... }
@stoffeastrom
stoffeastrom / zsh_history.sh
Created December 8, 2022 08:11 — forked from danydev/zsh_history.sh
Store commands in history only if successful
# README: This allows you to store in your history file only commands
# with a successful status (or forced exited by you with signal 2).
# Put this content in your .zhsrc
# CREDITS: inspired by https://scarff.id.au/blog/2019/zsh-history-conditional-on-command-success/
# This function will be hooked to zshaddhistory.
# zshaddhistory is called before a history line is saved. See zshmisc(1).
function my_zshaddhistory() {
# Prevent the command from being written to history before it's
# executed; save it to LASTHIST instead. Write it to history
ʕ◔ϖ◔ʔ
U+0295, U+25D4, U+03D6, U+25D4, U+0294