Skip to content

Instantly share code, notes, and snippets.

View sunnypp's full-sized avatar

Sunny Pun sunnypp

View GitHub Profile
@sunnypp
sunnypp / README.md
Last active June 4, 2019 07:24
Hammerspoon settings
@sunnypp
sunnypp / README.md
Created April 8, 2019 01:44
Clear Notification

Sometimes when you have left the screen on, and you walked away for a short while, like:

  • Using the washroom
  • Getting a slice of cake / snacks from a friendly colleague
  • Opening the door for someone in need

Then you may miss a notification from some Apps.

While the notification showing duration should be possible to be modified, that is not too reliable.

Instead, I'll use "alert" for notifications to ensure they stays until I dismiss them.

@sunnypp
sunnypp / speakers.scpt
Created December 28, 2017 01:56
AppleScript for switching sound output to Speakers
tell application "System Preferences" to activate
tell application "System Preferences"
reveal anchor "output" of pane id "com.apple.preference.sound"
end tell
tell application "System Events" to tell process "System Preferences"
tell table 1 of scroll area 1 of tab group 1 of window 1
select (row 1 where value of text field 1 is "Internal Speakers")
end tell
end tell
quit application "System Preferences"
@sunnypp
sunnypp / setup_dev.pl
Last active December 18, 2017 05:59
Boilerplate for macOS Development Environment Installation in Perl
use strict;
use warnings;
sub _print_num {
my $color_num = shift;
print `tput setaf $color_num`;
print shift;
print `tput sgr0`;
print "\n";
}