Skip to content

Instantly share code, notes, and snippets.

View olesu's full-sized avatar

Ole Kristian Sunde olesu

View GitHub Profile
@olesu
olesu / Makefile
Created July 19, 2023 19:31
Self-documenting Makefile
all: help
.PHONY: help
help: ## list available targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' ./Makefile | sort | awk 'BEGIN {FS = ":.*?## "} {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@olesu
olesu / mac-list-font-families.sh
Created February 8, 2023 16:51
List all installed font families on a Mac
#!/usr/bin/env bash
system_profiler -json SPFontsDataType| jq -r '.SPFontsDataType[].typefaces[].family' | uniq | sort
@olesu
olesu / tmux-new-or-attach.sh
Created December 9, 2021 07:38
Create new or attach to an existing TMux session
#!/usr/bin/env bash
WD="$1"
NAME="$(echo "$2" | tr '.' '_')"
if [ -z "$WD" ] || [ -z "$NAME" ]; then
echo "Usage: $0 path name" >&2
exit 1
fi

Keybase proof

I hereby claim:

  • I am olesu on github.
  • I am olesu (https://keybase.io/olesu) on keybase.
  • I have a public key ASAL0zs2BB7NAb3SDNl8e5QmT1ZBsdu_S0Gfxp8166WOLgo

To claim this, I am signing this object:

@olesu
olesu / simplecalc.groovy
Created September 9, 2015 17:42
Supersimple calculator implementation in Groovy
def calculator = new Calculator()
assert calculator.calculate('2 + 2') == 4
assert calculator.calculate('4 + 3') == 7
assert calculator.calculate('10 + 3') == 13
assert calculator.calculate('3 + 10') == 13
assert calculator.calculate('103 + 210') == 313
assert calculator.calculate('1250005 + 1210') == 1251215
assert calculator.calculate('1+ 1') == 2
sudo yum -y install http://fedora.uib.no/epel/6/i386/epel-release-6-8.noarch.rpm
sudo yum -y update
sudo yum -y install docker-io
@olesu
olesu / .editorconfig
Last active August 29, 2015 14:07
Basic .editorconfig file
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# Change these settings to your own preference
indent_style = space
indent_size = 2
@olesu
olesu / DynamicBean.groovy
Created November 22, 2012 19:50
Groovy Dynamic Bean Sample
class DynamicBean {
def properties
def random
DynamicBean() {
properties = [:]
random = Random.newInstance()
}