Skip to content

Instantly share code, notes, and snippets.

@moisoto
moisoto / SwiftForBeginners-Playgrounds.md
Last active August 26, 2022 17:12
Swift Playground Examples for Beginners
@moisoto
moisoto / DeleteLocalSnapshots.md
Last active February 11, 2021 20:17
MacOS - Free Disk Space by deleting Time Machine Local Snapshots

How to delete Time Machine Local Snapshots and free your Disk Space

List local snapshots:

tmutil listlocalsnapshots /

You will be presented with a list of snapshots like this:

@moisoto
moisoto / Create-Win10-Install.md
Last active February 2, 2021 19:44
Creating an Install Image for Windows 10 on a Mac

Creating an Install Image for Windows 10 on a Mac

Format Memory Stick

  • Insert your memory stick (16GB Minimum) and check the disk which is associated to it by executing the command diskutil list | grep external:
$ diskutil list | grep external
/dev/disk2 (external, physical):
@moisoto
moisoto / publish-your-package.md
Last active January 25, 2021 18:40
Publishing Your Package Documentation

Publishing your Package

Go Module!

If you haven't already go and initialize your module:

# This assumes you have your package located at ~/go/src/github.com/your_account/your_package
go mod init github.com/your_account/your_package
go mod tidy
@moisoto
moisoto / macOS_ZSH_working-with-options.md
Last active November 26, 2019 16:25
MacOS: ZSH Tidbits

Working with ZSH Options

When using ZSH as your default shell there is a chance you’ll set specific options on your .zshrc script to make work easier.

You can read about ZSH options and what they do here for more information on what you can do with zsh options.

Problem is, when doing ZSH scripts you can’t depend on the user having specific options. So you must be careful that you are not assuming the script works on any environment since your script may be depending on your specific options. Also the user may set an option that breaks your script.

To avoid this, you should set there following code at the start of all your zsh scripts:

@moisoto
moisoto / macOS_ZSH_word-list-for-loop.md
Last active November 26, 2019 21:35
MacOS: ZSH Tidbits

Working with a word list on a for loop

On bash:

#!/bin/bash
LIST="one two three"
for item in $LIST ; do echo $item ; done

On zsh:

@moisoto
moisoto / Working-With-read.md
Last active November 26, 2019 02:46
macOS: ZSH Tidbits

ZSH Tidbits: Working with the read command

The read command can be a headache when you are porting your scripts from a shell to another.

Let's see the way it works with bash (the default shell for macOS before Catalina):

read -p "Do you wish to continue? (Y/n)"
[[ $REPLY == "y" ]] && echo "You must use Capital Y if you wish to continue"
[[ $REPLY != "Y" ]] && exit