Skip to content

Instantly share code, notes, and snippets.

View ericchansen's full-sized avatar

Eric Hansen ericchansen

View GitHub Profile
@ericchansen
ericchansen / install-with-fresh-ubuntu.sh
Last active May 8, 2023 18:31
Fresh Ubuntu install script
sudo apt-get update && sudo apt-get upgrade
sudo apt-get -y install build-essential curl
git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-wincred.exe"
# Setup Docker. These directions work on WSL2.
sudo addgroup --system docker
sudo adduser $USER docker
newgrp docker
sudo chown root:docker /var/run/docker.sock
@ericchansen
ericchansen / .emacs
Last active November 5, 2021 15:12
My .emacs configuration
;; Highlights dumb stuff.
(require 'whitespace)
(setq whitespace-style '(face empty tabs lines-tail trailing))
(global-whitespace-mode t)
;; 80 column marker.
(
add-hook 'rust-mode-hook (
lambda ()
(setq-local whitespace-line-column 80)
@ericchansen
ericchansen / .emacs_on_windows
Created November 5, 2021 15:14
.emacs_on_windows
;; Place this file in C:\Users\<username>\AppData\Roaming and point to the appropriate files
(setq user-init-file "C:/path/to/.emacs")
(setq user-emacs-directory "C:/path/to/.emacs.d/")
(setq default-directory "C:/whatever/you/want/to/start/in")
(setenv "HOME" "D:/my/home/directory")
(load user-init-file)
@ericchansen
ericchansen / monitor_usb.ps1
Created May 24, 2023 18:19
PowerShell script to monitor device connects and disconnects on Windows.
$CurrentState = $null
$NewState = $null
Write-Host "Monitoring device changes..." -ForegroundColor Green
while ($true) {
if (-not($CurrentState)) {
$CurrentState = Get-PnpDevice -Status OK
}
else {
$NewState = Get-PnpDevice -Status OK
$Changes = $null
@ericchansen
ericchansen / apps-script.gs
Last active October 23, 2023 16:44
Import events from one calendar into another
function sync() {
var id = "ericchansen@gmail.com";
var today = new Date();
var endDate = new Date();
endDate.setDate(today.getDate() + 7);
var secondaryCal = CalendarApp.getCalendarById(id);
var secondaryEvents = secondaryCal.getEvents(today, endDate);
var primaryCal = CalendarApp.getDefaultCalendar();
var primaryEvents = primaryCal.getEvents(today, endDate);
var primaryEventTitle = "Personal Appointment";
@ericchansen
ericchansen / clean-detailed.omp.json
Created February 23, 2026 23:37
My customized Oh My Posh clean-detailed theme
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"pwd": "osc99",
"blocks": [
{
"alignment": "left",
"newline": true,
"segments": [
{
"background": "#FEF5ED",
@ericchansen
ericchansen / profile.ps1
Last active February 24, 2026 18:39
PowerShell profile - Oh My Posh theme, Split-Copilot, PSCommandHelper
# Oh My Posh initialization with pwd: osc99 for split pane directory inheritance
# Theme includes osc99 setting - see https://github.com/shanselman/splitpanefix
oh-my-posh init pwsh --config "https://gist.githubusercontent.com/ericchansen/1efbd10b90802f5102ca23b5a72b04e3/raw/clean-detailed.omp.json" | Invoke-Expression
# Git branch/tag tab completion
Import-Module posh-git
# Split pane and launch GitHub Copilot CLI in current directory
function Split-Copilot {
wt -w 0 split-pane -d "$PWD" pwsh -NoLogo -NoExit -Command "copilot"