Skip to content

Instantly share code, notes, and snippets.

@dan-c-underwood
dan-c-underwood / update_with_filevault.sh
Last active May 14, 2021 12:55
Updates a headless Mac with Filevault enabled by preauthenticating
#!/bin/bash
sudo fdesetup authrestart -delayminutes -1 && sudo softwareupdate -i -a -R
@dan-c-underwood
dan-c-underwood / my.fish
Created August 27, 2015 17:44
fish shell customisations
# Set paths
set -x GOPATH $HOME/Projects/go
set --universal fish_user_paths $fish_user_paths $GOPATH/bin
# Colored man pages
set -x LESS_TERMCAP_mb (printf "\e[02;31m")
set -x LESS_TERMCAP_md (printf "\e[01;31m")
set -x LESS_TERMCAP_me (printf "\e[0m")
set -x LESS_TERMCAP_se (printf "\e[0m")
set -x LESS_TERMCAP_so (printf "\e[01;44;33m")
@dan-c-underwood
dan-c-underwood / fish_greeting.fish
Last active January 25, 2024 22:21
Custom fish greeting (for fish shell)
function fish_greeting
echo ' '(set_color F00)'___
___======____='(set_color FF7F00)'-'(set_color FF0)'-'(set_color FF7F00)'-='(set_color F00)')
/T \_'(set_color FF0)'--='(set_color FF7F00)'=='(set_color F00)') '(set_color red)(whoami)'@'(hostname)'
[ \ '(set_color FF7F00)'('(set_color FF0)'0'(set_color FF7F00)') '(set_color F00)'\~ \_'(set_color FF0)'-='(set_color FF7F00)'='(set_color F00)')'(set_color yellow)' Uptime: '(set_color white)(uptime | sed 's/.*up \([^,]*\), .*/\1/')(set_color red)'
\ / )J'(set_color FF7F00)'~~ \\'(set_color FF0)'-='(set_color F00)') IP Address: '(set_color white)(ipconfig getifaddr en0)(set_color red)'
\\\\___/ )JJ'(set_color FF7F00)'~'(set_color FF0)'~~ '(set_color F00)'\) '(set_color yellow)'Version: '(set_color white)(echo $FISH_VERSION)(set_color red)'
\_____/JJJ'(set_color FF7F00)'~~'(set_color FF0)'~~ '(set_color F00)'\\
'(set_color FF7F00)'/ '(set_color FF0)'\ '(set_color FF0)', \\'(set_color F00)'J
@dan-c-underwood
dan-c-underwood / weather_io.rb
Last active August 29, 2015 14:22
Forecast.io based script designed for Today-Scripts. Powered by Forecast.
require "json"
require "net/http"
require "yaml"
require "colorize"
require "forecast_io"
def format_temp(temp)
temp_i = temp.to_i
temp = temp + "°C"
case
@dan-c-underwood
dan-c-underwood / weather.rb
Last active November 21, 2015 00:33
Alternate version (with Emoji) of the Today-Scripts weather script.
require "json"
require "net/http"
require "colorize"
def formatTemp(temp)
temp_i = temp.to_i
temp = temp + "°C"
case
when temp_i <= 0
temp.colorize(:blue)
@dan-c-underwood
dan-c-underwood / LICENSE
Last active February 24, 2022 17:04
Theme for oh-my-zsh. Shortened version of Agnoster.
The MIT License (MIT)
Copyright (c) 2022 Dan Underwood
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@dan-c-underwood
dan-c-underwood / FontColor.sublime-snippet
Last active August 29, 2015 14:01
Sublime snippet for font colours in HTML or Markdown
<snippet>
<content><![CDATA[<font color="$1">$2</font>]]></content>
<tabTrigger>fontcolor</tabTrigger>
<scope>text.markdown, text.html</scope>
</snippet>
@dan-c-underwood
dan-c-underwood / sieve.rs
Last active August 29, 2015 13:57
Rust implementation of sieve of Eratosthenes
use std::env;
fn main() {
//Get range from command line (primes in range 1..input)
let num = env::args().nth(1).unwrap();
let max: usize = match num.parse() {
Ok(n) => {
n
},