Skip to content

Instantly share code, notes, and snippets.

View ericchansen's full-sized avatar

Eric Hansen ericchansen

View GitHub Profile
@ericchansen
ericchansen / apps-script.gs
Last active October 23, 2023 16:44
Import events from one calendar into another
function sync() {
var id = "[email protected]";
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 / 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 / .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 / .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 / 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