- Open Automator
- Create a new document
- Select Quick Action
- Set “Service receives selected” to
files or folders
inany application
- Add a
Run Shell Script
action- your default shell should already be selected, otherwise use
/bin/zsh
for macOS 10.15 (”Catalina”) or later - older versions of macOS use
/bin/bash
- your default shell should already be selected, otherwise use
- if you're using something else, you probably know what to do 😉
Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.
NOTE: This logic can be extended to more than two accounts also. :)
The setup can be done in 5 easy steps:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script is needed because my default firewall rules are messed up and after | |
# every restart, docker containers can't make connections to the host, notably | |
# preventing debuggers like xdebug from attaching. | |
# If networking fails in your containers but works in others, rm and re-create the | |
# docker network that container is bound to. | |
set -euo pipefail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mobx from "mobx" | |
import store from "store" | |
export default function(_this) { | |
let firstRun = true | |
// will run on change | |
mobx.autorun(() => { | |
// on load check if there's an existing store on localStorage and extend the store | |
if (firstRun) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Copyright (c) 2016 Katsuya SAITO | |
# This software is released under the MIT License. | |
# http://opensource.org/licenses/mit-license.php | |
# | |
# @(#) softethervpn_letsencrypt_cert_autoupdate.sh ver.0.1.0 2016.02.20 | |
# | |
# Usage: softethervpn_letsencrypt_cert_autoupdate.sh CommonName WEBROOT PASSWORD MAIL | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem | |
// throw QuotaExceededError. We're going to detect this and just silently drop any calls to setItem | |
// to avoid the entire page breaking, without having to do a check at each usage of Storage. | |
if (typeof localStorage === 'object') { | |
try { | |
localStorage.setItem('localStorage', 1); | |
localStorage.removeItem('localStorage'); | |
} catch (e) { | |
Storage.prototype._setItem = Storage.prototype.setItem; | |
Storage.prototype.setItem = function() {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Check if an IP address is listed on one of the following blacklists | |
# The format is chosen to make it easy to add or delete | |
# The shell will strip multiple whitespace | |
BLISTS=" | |
b.barracudacentral.org | |
bb.barracudacentral.org | |
bl.deadbeef.com | |
bl.mailspike.net |
NewerOlder