Skip to content

Instantly share code, notes, and snippets.

@HunterDG
HunterDG / Definitive retroactive .gitignore
Created August 16, 2019 03:22
How to make Git **properly forget** (historically) about a file now in .gitignore
> This method makes git **completely forget** ignored files (**past**/present/future), but does **not** delete anything from working directory (even when re-pulled from remote).
> This method requires usage of `/.git/info/exclude` (preferred) **OR** a **pre-existing** `.gitignore` in **all** the commits that have files to be ignored/forgotten. <sup>1</sup>
> All methods of enforcing git ignore behavior after-the-fact effectively re-write history and thus have [significant ramifications](https://stackoverflow.com/q/1491001) for any public/shared/collaborative repos that might be pulled after this process. <sup>2</sup>
> General advice: **start with a clean repo** - everything committed, nothing pending in working directory or index, **and make a backup**!
> Also, the comments/[revision history](https://stackoverflow.com/posts/57454176/revisions) of [this answer](https://stackoverflow.com/a/57454176) ([and revision history](https://stackoverflow.com/posts/57418769/revisions) of [this question](https://stack
@HunterDG
HunterDG / SplitTunnel.app
Created April 18, 2018 03:29
Mac Cisco VPN Split Tunnel AppleScript
global done
set done to 0
on idle
set status to do shell script "scutil --nc status "VPN (Cisco IPSec)" | sed -n 1p"
# do shell script "scutil --nc start "VPN (Cisco IPSec)"
if status is "Connected" then
if done is not 1 then
display notification "VPN Connected, splitting tunnel"
set gateway to do shell script "( netstat -rn | awk '/default/ {if ( index($6, \"en\") > 0 ){print $2} }' ) # gets non-VPN default gateway"