Skip to content

Instantly share code, notes, and snippets.

Matt McKellar-Spence MattMS

Block or report user

Report or block MattMS

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
MattMS /
Created Nov 13, 2017
Delete all Docker Images with no ("<none>") tag.
docker images | awk '$2 == "<none>" {print $3}' | xargs docker rmi
View Compose Express

Compose Express calls

compose = (calls)-> (req, res, next)->
	if calls.length
		calls[0] req, res, ->
			call = compose calls.slice 1
			call req, res, next
	else if next
MattMS /
Last active Jul 21, 2017
Print file name (minus `.txt` extension), `=`, then file contents
#!/usr/bin/env fish
set ext '.txt'
for f in (ls | grep $ext)
echo (basename $f $ext)=(cat $f)
MattMS / Append to
Created Jul 13, 2017
Append to current folder to PATH in Fish Shell
View Linux users and

Users in Linux

Sorted list of all users:

cat /etc/passwd | awk -v FS=: -e '{print $1}' | sort

Switch to another user (prompts for password):

su - my_other_user
MattMS / Kubernetes
Last active Mar 27, 2017
Kubernetes tasks with kubectl
View Kubernetes

Kubernetes tasks

Get credentials before using kubectl:

gcloud container clusters get-credentials my-cluster --project my-project --zone my-zone

Pod management

Delete all pods (in all namespaces) that are in "Error" state:

MattMS / Ramda
Created Mar 25, 2017
Possibly helpful function compositions for Ramda.
View Ramda

Ramda extensions

Test a path exists:

const has_path = R.pipe(R.path, R.complement(R.isNil))
MattMS / Node.js Ubuntu
Last active Jul 21, 2017
Install Node.js on Ubuntu from package manager
View Node.js Ubuntu

Install Node.js on Ubuntu

The [official instructions][install] say to download and run a script with sudo, which should sound scary. So I went through the script and wrote up what it is doing.

It's actually fine to run, but it's not much harder to do it all yourself.

Add the key

MattMS /
Created Mar 10, 2017
Get an access token for future requests to Google Cloud APIs
-H "Metadata-Flavor: Google"
| awk '$1 == "access_token" { print $2 }')
size=$(ls -l ./my_file | awk '{ print $5 }')
echo $size
You can’t perform that action at this time.