Skip to content

michaelvobrien/macos-bash-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Bash commands for macOS.

  • sshvpn -- vpn/proxy through a remote server
  • alarm -- wake up to iTunes and a computer voice
  • pomodoro -- notifications to take a break

Requirements

brew install terminal-notifier \
             dtach \
             fswatch

Set the PATH to include the bin directory.

sshvpn

sshvpn sets the macOS preferences to use a SOCKS proxy at 127.0.0.1:PORT (e.g. PORT=8111). Next, sshvpn establishes a ssh connection to a remote host with the SOCKS port forwarding option, tunneling traffic through 127.0.0.1:8111. sshvpn disables the macOS SOCKS proxy when ssh is terminated with Ctrl-c.

Add host to ~/.ssh/config:

Host myserver
  Hostname        <IP_ADDRESS>
  IdentityFile    ~/.ssh/<ID_FILE>
  UseKeychain     yes
  AddKeysToAgent  yes
  User            <USER>
  Port            <PORT>

Examples

sshvpn myserver 8111

myvpn-service has the host and port set, and it uses dtach to put it into the background.

myvpn-service

sshvpn should set the network preferences as follows.

alarm

alarm uses iTunes and the macOS voice as an alarm. First, create an iTunes playlist titled "Alarm" and add songs to it. The "Alarm" playlist will be used. Configure alarm-cron.

Schedule alarm

crontab -e
#min    hour    mday    month   wday    command
30      7       *       *       *       /path/to/bin/alarm-cron

Turn off alarm

This is purposely difficult in order to become more aware and awake.

ps aux | grep alarm
# see what the alarm pid is
kill ALARM_PID

pomodoro

pomodoro displays a macOS notification after X minutes as a reminder to take a beak.

  • Set alert style to "Alerts" instead of "Banners".
  • Uncheck all other options.

Examples

pomodoro 20

To run it in the background:

pomodoro-service
# or
pomodoro-service 20

About

Bash commands for macOS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages